DataSource Controls :: Get The @@Identity From A Table By Using A Stored Procedure Called By Website

Jul 10, 2010

I am trying to get the @@Identity from a table by using a stored procedure called by my website. I am using a datareader to do this but get an error as it tells me it cannot convert the returned value to getint. Here is my code. What should I be using instead of getint?

Dim myReader = cmd.ExecuteReader()
While (myReader.Read())
intID = myReader.GetInt32(0)
End While

View 3 Replies

Similar Messages:

DataSource Controls :: How To Find Stored Procedure From Which This Is Called

May 19, 2010

There is one sp(1) which is called from another sp(2)How can I find from which sp it is called.

View 2 Replies

DataSource Controls :: Using Table Variable In Stored Procedure?

Feb 18, 2010

I've written a stored procedure which uses a table variable. The stored procedure is shown below:


The table variable @CaseNumbers is declared, and is a bunch of values are inserted using a table-valued function called SplitStringIntoInts. At this point I can select from @CaseNumbers and this works fine.But when I try to join onto @CaseNumbers, the name '@CaseNumbers' in the ON clause is highlighted with the error 'Must declare scalar variable @CaseNumbers'. What?! It's not scalar, I declared it ages ago and I have used it since!

View 3 Replies

DataSource Controls :: How To Join Table In Stored Procedure Sql Server Db

Jun 9, 2010

my stored procedure is always extract some data into temp table such as"select name,address,content into #TEMP1 from table1,table2,table3"
finally, select another table together with #TEMP1 to extract all desire data from one queryselect,T.address,T.content,C.other from #TEMP1 T, otherTable C
where T.ID=C.IDI would like to ask if i want to join one more table T2 into final query with "otherTable left C outer join on C.ID=T2.ID"

View 1 Replies

DataSource Controls :: When Use ##Temp Table In Stored Procedure, It Gives An Error?

Jun 15, 2010

i m using ##Temp Table in stored gives this error There is already an object named '##people' in the two case of multisession2. if transaction drop in between even i drop Table in Last in stored procedure..what can i use in place of temp table to hold data for a time being

View 1 Replies

DataSource Controls :: Stored Procedure Does Not Indicate Table Returned In Dataset?

Apr 23, 2010

This may not be the correct place to put this as it is both a stored procedure AND Visual Studio 2008 problem.

I have the following stored procedure:


I have been mokeying around with it because of what is happening. I have a dataset, call it dataset1. I drag this stored procedure onto the dataset. I EXPECT a datatable to appear, instead the data set adds this store procedure to the queries table adapter and sets the exec mode to 'NonQuery' which unless I am very mistaken, means "don't expect a dataset back from this' when in fact you DO expect a dataset back from this.

The SQL server is a Windows 2000 Server running SQL 2000. It has never caused us a moments grief since we set it up oh-so-many years ago.

If I connect to a different database and drag a query into the same dataset I get a datatable as I expect. I cannot see where / how this procedure could be wrong. The query when executed returns exactly the data I expect, in the format I expect (looks like a table, acts like a table in the Query analyzer).

View 3 Replies

DataSource Controls :: Insert ID Field Into SQL Table Programatically From Stored Procedure?

Oct 6, 2010

I have a table in SQL where I insert data (CatCodes) using C# code but I want to insert ID code (DealerID) with it as well. Following is my Stored Procedure and C# code:




As you can see, I am insering CatCode values in Categories table using string cbspecialities.

How can I insert DealerID the same way? DealerID is automatically generated in tblDealers table when "InsertExternalInfo" asp.SqlDataSource control runs "InfoInsert" SP.


View 2 Replies

DataSource Controls :: Eliminate Returning Of Empty Table From Stored Procedure

Jul 12, 2010

I have a Procedure which should return only 1 Record on selecting record according to Priority.

DECLARE @Accounts nvarchar(MAX)
SELECT @Accounts = ISNULL([map_user_modules].[Accounts], '') FROM [map_user_modules]
WHERE [map_user_modules].[id_user] = 231 AND [map_user_modules].[id_module] = 5
IF ((@Accounts = '') OR (@Accounts = 'All'))
SELECT @Accounts = null

Select @@ROWCOUNT as Priority2

Select @@ROWCOUNT as Priority3

Select @@ROWCOUNT as Priority4

In the above statement Suppose we take a scenario where Select @@ROWCOUNT as Priority3 is executed, I get two tables returned, One is the Table returned by Select @@ROWCOUNT as Priority3 and the other is the Table returned by Select @@ROWCOUNT as Priority2 which has no Records. How can I eliminate the Empty table that returns no records.

View 1 Replies

DataSource Controls :: Create A Stored Procedure That Displays Data From A Table?

Mar 22, 2010

More specifically, i'm trying to create a stored procedure that displays data from a table if the date column in the table matches a specific day of the week. (IE. Monday, Tuesday, ect...)

The date in my table is stored as MM/DD/YYYY.

View 5 Replies

DataSource Controls :: Stored Procedure For Delete Records From Parent And Child Table

Jan 16, 2010

I have two tables dept and employees those table have parent and child relation ship link column is deptno i want to delte department even this departmetn contains employees i want to write storedprocedure for first delte employees and after department if i wrtie these two querys in storedprocedure will i get any problems

Delete from tbl_employees where Department_Id=@Department_Id
Delete from tbl_Department where Department_Id=@Department_Id

View 5 Replies

DataSource Controls :: How To Convert The Oracle Stored Procedure To Sqlserver 2005 Stored Procedure

Apr 2, 2010

This is surareddy. i nead some small clarification in the "Stored Procedure"

how to convert the oracle Stored Procedure to sqlserver2005/2008 Stored Procedure.

right now i am enhancing the project that project already developed the oracle Stored Procedure. now our company is using sqlserver 2005/2008.

how to convert the Oracle Stored Procedure to sqlserver 2005 Stored Procedure

View 4 Replies

DataSource Controls :: Do Not Use Or Call Any Stored Procedure But It Says "Could Not Find Stored Procedure 'xxxxx'?

Dec 9, 2010

Initially, I have tried to use stored procedure. But I changed my mind and preferred to call sql query in codebase with command text. However, it stills tries to find initially-called stored procedure (which is neither called or exists).I think that it is related caching. But I tried it with different browsers it did not work.What might be the reason?

View 4 Replies

DataSource Controls :: Execute A Stored Procedure Within A Stored Procedure?

Jan 18, 2010

Does anybody if it is possible that a stored procedure returns rows which is the result of the execution of another sp? Something like..


View 11 Replies

DataSource Controls :: How To Call A Stored Procedure In Another Stored Procedure

May 13, 2010

i want to return output parameter from 1 storeprocedure. into another stored procedure.

View 7 Replies

DataSource Controls :: What Is Better: Connecting To DB With One Stored Procedure To Get Two Table At Once OR Connecting...

May 20, 2010

While working with LINQ to ENTITIES I see that there is only a way to use stored procedure that is returning one entity only, or a view that is a join of two entities.

But what if I need in ASPX page to get two tables that there is NO connection between them, no join can be done between them at all.

I have one Stored Procedure that return the two tables, but entities don't support this right now.

I can split them to two Stored Procedure and call each of them separately.

View 2 Replies

SQL Server :: Inserting Using A Stored Procedure And Identity Column?

Nov 19, 2010

I recently moved a .net site from one machine to another, now for some reason one of the stored procedures is throwing an exception when attempting to insert!

Exception Details: System.Data.SqlClient.SqlException: An explicit value for the identity column in table 'dbo.tbl_Events' can only be specified when a column list is used and IDENTITY_INSERT is ON

BTW, the column in question does have the identity set to Yes in management studio

I was using originally SQL 2005, now its on SQLexpress 2008

stored procedure:


View 8 Replies

DataSource Controls :: Getting @@Identity Value From Stored Proc?

Jul 2, 2010

I've been self teaching SQL and and i'm a little stuck. I have a stored proc for the insert and then in my Insert inside my class it's not returning the ID after the insert as I am receiving an error message that NULL value has cannot be inserted. I want to add default values to a seperate table after the insert. I will provide my code below, if anyone can help me why the value is not going across?


View 7 Replies

DataSource Controls :: Call One Stored Procedure In Another Procedure For Search?

May 1, 2010

I want to apply other stored procedure select query on result of first stored procedure.

View 1 Replies

DataSource Controls :: Stored Procedures Are Not Showing Up Correctly In The Stored Procedure Drop Down

Apr 27, 2010

I am using Visual Studio 2008 and SQL Server 2008 and have added a SQL datasource to my form.

When I configure the datasource, I choose my connection string which looks like this in my webconfig:



The database I am using has a schema called EQB and as such, my stored procedures are named as EQB.usp_SelectFunds, EQB.usp_SelectAccount, etc.

On the select tab of the Configure Data Source screen, I choose to use a stored procedure. The dropdown shows my stored procedures, however, the schema name does not show up in front of the stored procedures in the drop down. I see only usp_SelectFunds, usp_SelectAccount, etc.

I select one of the stored procedures and when I click TEST, I get the message that the stored procedure is not found. If I instead choose to use a SQL statement instead on the configuration screen and enter EXEC EQB.usp_SelectFunds and click TEST, it works fine.

Why are my stored procedures not showing up correctly in the stored procedure drop down and how can I fix this?

View 3 Replies

ADO.NET :: Select Stored Procedure Called By LINQ In Entity Framework?

Jan 6, 2011

I have a stored procedure that receives 2 parameters and returns 3 columns.

Here is how I added the SP:

1. Added SP to entity model (.edmx) via update model from DB.

2. Did a Function Import -- selected my SP, clicked "Get Column Information" and then created a new complex type (myStoredProcedureName_Result) which I assigned.

3. My LINQ is the following:


View 3 Replies

C# - Grid Data Bound To Stored Procedure Getting Called Multiple Times?

Mar 8, 2011

I have an application that uses an aps:GridView. The GridView is populated using a DataSource that calls a Stored Procedure. The DataSource passes parameters to the Stored Procedure based on some text fields. The page has been running slower than wanted, so I was doing some checking.

I ran SQL Profiler while loading the page, and saw the Stored Procedure was being called twice. I stepped through the code and found out that in the Page Load Complete event was where this was happening. In this event, I set the value of a parameter for the Stored Procedure, then did a DataBind on the GridView to pick up the data. As I was stepping through the code, I watched the SQL Profiler. When I got to the step of setting the parameter, the Stored Procedure had not yet been called. When I stepped through that and got to the DataBind command (before running that step), the SQL Profiler showed that the Stored Procedure had been called. Then I did the DataBind and the StoredProcedure was called again.

My question is, how do I get the parameters set, and get the GridView data bound, and only call the StoredProcedure once? If I comment out the DataBind step, the StoredProcedure never does get called (which seems really strange to me...).

View 1 Replies

Web Forms :: Choosing Return Type When Stored Procedure Is Called From Entity Framework

Sep 16, 2012

I have a stored procedure in SQl and i am calling through Entity framework through import functions. Stored procedure is returns columns from 2 different tables.. now what should be return type at Entity framwork end ?

View 1 Replies

DataSource Controls :: Use Scope Identity To Get Newly Inserted Table

Feb 14, 2010

I have an SQL Server table named "Fields" with an autoincrement identity column "FieldID" as the primary key, an nchar column "Phrase" that textbox entries are to be stored in from a web page, and another column that is defaulted to null. The following is the recommended example on how to use Scope_Identity() to get a newly inserted table row identity value:

string query = "Insert Into Categories (CategoryName) Values (@CategoryName);" +
"Select Scope_Identity()";
int ID;
string connect = @"Server=.SQLExpress;AttachDbFilename=|DataDirectory|Northwind.mdf;" +
using (SqlConnection conn = new SqlConnection(connect))
using (SqlCommand cmd = new SqlCommand(query, conn))
cmd.Parameters.AddWithValue("@CategoryName", Category.Text);
ID = (int)cmd.ExecuteScalar();

Obviously, this example uses a Categories Table in a Northwind database, which I do not have. So I am confused by how to adapt this example for my application. The following is my data context:

DataClassesDataContext db = new DataClassesDataContext();

Could you explain how I can adapt the example for my "Fields" table in my "EFMDB" database?

View 13 Replies

DataSource Controls :: To Use Stored Procedure In .net

May 30, 2010

how to use stored procedure in for for manipulation form sql server (in details).

View 2 Replies

DataSource Controls :: Stored Procedure In .net?

Mar 31, 2010

parameters inside the stored procedure.How to write .

View 6 Replies

Copyrights 2005-15, All rights reserved