.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

How to post multiple declare statements

Posted By:      Posted Date: October 27, 2010    Points: 0   Category :ASP.Net

I know how to do this with 1 declare statement, but for this there are multiple one's.  This example sql statement has 2, however my  actual one will have 29.

declare @Amount1 float, @Amount2 float
select top 1 @Amount1 = CAST(dbo.Designated_Amount.Amount AS Float)
  FROM dbo.Designated_Amount INNER JOIN
    dbo.SIMS ON dbo.Designated_Amount.Unit_Code = dbo.SIMS.Unit_Code
  Where (dbo.Designated_Amount.Unit_Code = '114') AND dbo.SIMS.Event_Type in ('IR','ME','MO','PE','PO','RU','SF','U1','U2','U3') AND (dbo.SIMS.EventEndTS is Null)AND (dbo.SIMS.Avail_Cap = 0))

select top 1 @Amount2 = CAST(dbo.Designated_Amount.Amount AS Float)
  FROM dbo.Designated_Amount INNER JOIN
    dbo.SIMS ON dbo.Designated_Amount.Unit_Code = dbo.SIMS3.Unit_Code
  Where (dbo.Designated_Amount.Unit_Code = '105') AND dbo.SIMS3.Event_Type in ('IR','ME','MO','PE','PO','RU','SF','U1','U2','U3') AND (dbo.SIMS3.EventEndTS is Null)AND (dbo.SIMS3.Avail_Cap = 0))
  ORDER BY dbo.SIMS3.EventStartTS DESC

;with cte1 as (SELECT TOP (1) CASE WHEN V300938F <= '.1' THEN coalesce(@Amount1,0) 
 ELSE 0 END AS Available

View Complete Post

More Related Resource Links

Multiple update statements per row in Gridview Edit


I want to set up a gridview that will display data like this

WeekEndingDate Project Category Sun Mon Tues Wed Thu Fri Sat
8/14/2010      proj1   test     2   1   2    3   2   1   0
8/21/2010      proj1   test     0   2   2    2   2   1   0
8/28/2010      proj1   test     0   1  

Multiple statements in SSCE 3.5 SP2?

Hi all, I'm just wondering whether it's possible at all to execute multiple statements & multiple heterogeneous statements using the semicolon (";") separator.  SSCE balks at it right now if I issue via ADO.NET command text similar to the following (line separator is your typical \r\n): insert into Foo (id, name) values (1, 'foo1'); insert into Bar (id, name) values (1, 'bar1'); update Goo g set g.name = 'Goo1', g.fooId = 1, g.barId = 1 where id = 1; SQL Server Management Studio executes it just fine, which led me to believe that I could do it via ADO.NET. Can someone who knows please clarify?  What do I have to do in order to batch commands to ADO.NET? Thanks, Matthew

Multiple sql-statements in one transaction

Hi - I've two sql-statements - two inserts statements.The first one creates a person and the next creates an entry in another table with the person id as reference - everything works fine but I've been looking at my code and would like to know how I should wrap it up before firing the statements.I keep it all in one transaction - if the creating of the person fails or the other operation I need to rollbackMy question is:Should I use the same SqlCommand object to fire both statements? At this point I create a new instance for each statement - but isn't it possibly to use the same SqlCommand object, the same SqlConnection and wrap it into the same SqlTransaction?What is best practise in situations like this?

'Add Service Reference' not working for multiple include statements


I'm using VS 2010 (.NET 4.0) and I cannot use 'Add Service Reference' to generate my .NET proxy client since looks like using 'Add Service Reference' (svcutil.exe) option doesn’t work if there are multiple include statements for the schemas in the wsdl. Using "Add Web Reference" (wsdl.exe) option does work to consume this kind of wsdl but having issues passing UsernameToken.

My understanding is it generates WCF client only if 'Add Service Reference' option is used and not 'Add Web Reference'.

The web service is from the 3rd party, so I cannot modify it and they expect UsernameToken in the SOAP header.

Here’s the url to get the package that co

INSERT the Results of a Stored Procedure with Multiple SELECT Statements into Multiple Tables?

I have a stored procedure (which is overly complex and written by someone else) that I need to take the results of and put them into tables.  The stored procedure uses Dynamic SQL to build and then run 5 SELECT statements based on literally hundreds of variables.  I need to take the results of these SELECT statements and put them into tables in a different database.  Rewriting or re-creating the logic of the stored procedure is NOT AN OPTION as the logic may change over time and maintaining it in multiple places would be nightmarish.  Can anybody help me with this?  I've googled extensively, but have only been able to find examples of using one result set not multiple ones.

MSSQL 2005 JDBC driver multiple select statements in stored procedure



we have a stored procedure with multiple select in it.



Select a,b,c from table1

Select f,g,h  from table2

Select j,k,l  from table3


Sometimes select no 2 will not return any values.

when this happens  we get only 2 result sets using CallableStatement getMoreResults method. 

it seems that if a select  doesn't return something it will  not have a corresponding resultset. 

On 2000 (driver + server) version we got an empty resultset for this situation. 

Is there  any  way to have the same behaivor with 2005 ?   We tryed with 1.2 and 2.0 jdbc driver.




Multiple statements are not allowed.


Hi I'm trying this  :



([Date].[Fiscal Year].&[2008],



[Measures].[Sales Amount Quota]);




= (ParallelPeriod([Date].[Fiscal].[Fiscal Year], 1,



[Measures].[Sales Amo

AJAX Post with multiple items



I am attempting to do my first post using Jquery Ajax.

I have a dynamically created set of textboxes depending on the previous getJSON.

$(data).each(function () {
                            var incScreeningHeader = $("<th>").text(this.ResourceText);
                            if (this.MemberScreeningProperties == undefined) {
                                var html = "<label name='NewScreenLabel' for=' " + this.ResourceText + "'>" + this.ResourceText + "</label><input type='text' name='newScreen' id='" + this.ScreeningPropertyID + "' /><br />";

Now I need to return each of these 'ScreeningPropertyID's and ScreeningValues in an AJAX Post. I am able to access the ID and the value entered in each textbox this way:

function GetScreeningValues() {

        var newScreening = new Object();

        $('input').each(function () {
            if ($(this).attr("name") === "newScreen") {

Multiple database support with Entity Framework

One of the features introduced in Entity Framework is being database independent. Which mean each database provider can support Entity Framework by implementing its provider.

This feature allows you build applications independent from the underplaying database provider. In this post I'm going to show how to build an application that support multiple databases using same conceptual model made by Entity Framework.

Binding the multiple drop down boxes in GridView using JQuery in ASP.NET

Here is the code for binding the multiple drop down boxes in GridView using JQuery in ASP.NET

Upload Multiple File using JQuery in asp.net

In this article I have explained how to upload multiple files using file upload control. I have used jQuery plugin for uploading multiple files.

I have also explained how to check for file type, file maximum size limit using jQuery & also using server side validation code.

Adding Multiple Columns and Rows in GridView without using a Database

This article describes on how to add multiple columns and rows in GridView without using a database. Basically the GridView will be populated with data based on the values entered in each TextBoxes on Button Click and retain the GridView data on post back.

GridView Multiple Filter AJAX Control

This AJAX control enables the user to filter data within any column inside a GridView. The user can add multiple filters and can delete existing ones too.

Multiple Column Dropdownlist for the ASP.NET DataGrid

Based on my previous control "Multiple Column DropDownList for ASP.NET", I received many emails asking for the same control to be used in the DataGrid for web applications. Here we go.. This control can be used as the regular MS DropDownList in the DataGrid and also as a regular dropdownlist. It has all the properties, like DataTextField, DataValueField, DataSource, SelectedIndex etc. The download file contains the samples both in VB.NET and C#. In this sample, I have used the Northwind database of SQL Server.

ASP.NET Multiple Selection DropDownList with AJAX HoverMenuExtender

Recently, I was looking for a multiple selection dropdownlist control for my new project. After spending some time researching for it, I decided to put together all my finding in one web user control. This web user control consists of an ASP.NET AJAX HoverMenuExtender, JavaScript, StyleSheet and CheckBoxListExCtrl . The final product will work with or without a MasterPage and you can drag and drop more than one instances of the control on to the page.


Defines the attributes of a Transact-SQL server cursor, such as its scrolling behavior and the query used to build the result set on which the cursor operates. DECLARE CURSOR accepts both a syntax based on the ISO standard and a syntax using a set of Transact-SQL extensions.

jquery autocomplete multiple values


i got some samples and i did autocomplete using jquery , its working well for single input values

but i need to pass multiples values after one by one in the textbox. Is it possible to pass multiple

values in the textbox for autocomplete in jquery in asp.net?


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend