473,378 Members | 1,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Identity

Mex
Hi

Is possible to get identity value with SCOPE_IDENTITY()
if i use DataSet, SqlDataAdapter and CommandBuilder?
MyDataRow = MyDataSet.Tables(MyBaseTable).NewRow
MyDataSet.Tables(MyBaseTable).Rows.Add(MyDataRow)

Dim cb As New SqlCommandBuilder(MyDataAdapter)

MyDataAdapter.Update(MyDataSet, MyBaseTable)

With best regards;
Mex
Jun 7 '07 #1
2 957

"Mex" <re*******@hot.eewrote in message
news:OE**************@TK2MSFTNGP04.phx.gbl...
Hi

Is possible to get identity value with SCOPE_IDENTITY()
if i use DataSet, SqlDataAdapter and CommandBuilder?
MyDataRow = MyDataSet.Tables(MyBaseTable).NewRow
MyDataSet.Tables(MyBaseTable).Rows.Add(MyDataRow)

Dim cb As New SqlCommandBuilder(MyDataAdapter)

MyDataAdapter.Update(MyDataSet, MyBaseTable)
The short answer is no.

But this may work for you.

http://www.vbforums.com/showthread.php?t=352219

Jun 7 '07 #2

Mex

Why not, however proces the select with the executescalar

http://msdn2.microsoft.com/en-us/lib...utescalar.aspx

Cor

"Mex" <re*******@hot.eeschreef in bericht
news:OE**************@TK2MSFTNGP04.phx.gbl...
Hi

Is possible to get identity value with SCOPE_IDENTITY()
if i use DataSet, SqlDataAdapter and CommandBuilder?
MyDataRow = MyDataSet.Tables(MyBaseTable).NewRow
MyDataSet.Tables(MyBaseTable).Rows.Add(MyDataRow)

Dim cb As New SqlCommandBuilder(MyDataAdapter)

MyDataAdapter.Update(MyDataSet, MyBaseTable)

With best regards;
Mex

Jun 7 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Edward | last post by:
SQL 7.0 I have a form in ASP.NET and I want to write the values to the SQL Server tables. The tables are Customer and Address tables. There will be an insert into the Customer table, and I...
5
by: DBA | last post by:
I have an identity field on a table in SQL Server. The identity seed is 1 and the identity increment is 1. If I remove a record from this table, the identity sequence is broken. For example: ...
5
by: grzes | last post by:
MS SQL Server 2000. My case is: I have the table T with primary key calling __recid int without identity property. This table includes a lot of records (about 1000000). I need to convert __recid's...
5
by: Eugene | last post by:
I have a table EugeneTest(id_num, fname, minit, lname) where field "id_num" is type IDENTITY and has UNIQUE constraint Let's say 2 user execute this code at the same time: DECLARE @return...
4
by: brent.ryan | last post by:
How do I get the next int value for a column before I do an insert in MY SQL Server 2000? I'm currently using Oracle sequence and doing something like: select seq.nextval from dual; Then I...
8
by: Razak | last post by:
Hi, I have a class which basically do Impersonation in my web application. From MS KB sample:- ++++++++++++++++++++code starts Dim impersonationContext As...
3
by: Dan | last post by:
I'm writing a record from an asp.net page to SQL Server. After the insert I'm selecting @@identity to return the ID of the record that I just wrote. It worked fine until I typed a semicolon into...
5
by: Veeru71 | last post by:
Given a table with an identity column (GENERATED BY DEFAULT AS IDENTITY), is there any way to get the last generated value by DB2 for the identity column? I can't use identity_val_local() as...
3
by: Rob | last post by:
Hi all, I have a bit of a complicated question, hope we have an SQL guru out there that can help us solve this killer problem. Due to the size of SQL Database we have (largest in the US), we...
13
by: PinkBishop | last post by:
I am using VS 2005 with a formview control trying to insert a record to my access db. The data is submitted to the main table no problem, but I need to carry the catID to the bridge table...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.