By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,165 Members | 1,372 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,165 IT Pros & Developers. It's quick & easy.

VB.NET Retrieving Identity from MSSQL2000 without using stored procedures

P: n/a
Hello!
I have a problem. I'm using a dataset in VB.NET with multiple tables with
relations between them. I would like dataset to update to all related tables
with right identity, when certain record is added.

The problem is that I don't know how to do it, when I'm not using stored
procedures. I found an article in which OnRowUpdated event of the
dataadapter is used. On this event ExecuteScalar method of the oledbcommand
object is called to retrieve "@@Identity"

http://msdn.microsoft.com/library/de...us/cpguide/htm
l/cpconretrievingidentityorautonumbervalues.asp

But this example was for Access 2000 database. I tried to translate it for
MSSQL 2000 but ExecuteScalar always returns
null.

In the same article there's an example which calls a stored procedure in a
insert command. In that case everything is working perfectly, all child
tables in dataset are automatically changed.

Does anybody have any idea how to solve this?

Regards, Taras





Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hello,

"Taras" <ta*************@manto.net> schrieb:
I have a problem. I'm using a dataset in VB.NET with multiple
tables with relations between them. I would like dataset to
update to all related tables with right identity, when certain record
is added.


This is a VB.NET language group. Notice that you will have a better
chance to get an answer if you post to the ADO.NET newsgroup in future:

news://msnews.microsoft.com/microsof...amework.adonet

Web interface:

http://msdn.microsoft.com/newsgroups...amework.adonet

--
Herfried K. Wagner
MVP VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.