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

Create Update DS

P: n/a
Hello,

I have a stored procedure which generates some values in the table.
When I use update() how to populate the dataset with theses values ?

For the moment I use output parameter but it just works for 1 row and as the
dataset doesn't have the value I should put it after and the rowstate goes
to "modified"...

Any ideas ?

SIncerly,

Mar 2 '07 #1
Share this Question
Share on Google+
8 Replies


P: n/a
I don't understand what you mean.

Does your stored procedure generate values in the table in SQLServer? Or
are you trying to write data to the table in SQLServer? Or do you have data
in the table in SQLServer, and are trying to read it?

Robin S.
------------------------------------

"Ornette" <abstrait...nospam...@free.frwrote in message
news:12**********************************@microsof t.com...
Hello,

I have a stored procedure which generates some values in the table.
When I use update() how to populate the dataset with theses values ?

For the moment I use output parameter but it just works for 1 row and as
the dataset doesn't have the value I should put it after and the rowstate
goes to "modified"...

Any ideas ?

SIncerly,

Mar 4 '07 #2

P: n/a
Ok, sorry it was not so clear.

I have an update sotred procedure wich generates values in SQL Server.
I replaced the output parameted with a Select ... @@Identity at the end of
the procedure.
It seems ok, but I don't know what exaclty will happen when I will send an
entire dataset with multiples row added, modified and deleted to the
Update() function (which calls Insert, Update and Delete stored
procedures)...

Ornette.
"RobinS" <Ro****@NoSpam.yah.nonea écrit dans le message de
news:vI******************************@comcast.com. ..
>I don't understand what you mean.

Does your stored procedure generate values in the table in SQLServer? Or
are you trying to write data to the table in SQLServer? Or do you have
data in the table in SQLServer, and are trying to read it?

Robin S.
------------------------------------

"Ornette" <abstrait...nospam...@free.frwrote in message
news:12**********************************@microsof t.com...
>Hello,

I have a stored procedure which generates some values in the table.
When I use update() how to populate the dataset with theses values ?

For the moment I use output parameter but it just works for 1 row and as
the dataset doesn't have the value I should put it after and the rowstate
goes to "modified"...

Any ideas ?

SIncerly,

Mar 4 '07 #3

P: n/a
I don't know how you're doing your updates, or what your SP looks like.

If you have a DataSet and are submitting the updates using a DataAdapter,
it iterates through the rows and performs each update/delete/insert as
needed, so it should retrieve the updated identity column value as it goes.

Robin S.
---------------------------
"Ornette" <abstrait...nospam...@free.frwrote in message
news:A0**********************************@microsof t.com...
Ok, sorry it was not so clear.

I have an update sotred procedure wich generates values in SQL Server.
I replaced the output parameted with a Select ... @@Identity at the end
of the procedure.
It seems ok, but I don't know what exaclty will happen when I will send
an entire dataset with multiples row added, modified and deleted to the
Update() function (which calls Insert, Update and Delete stored
procedures)...

Ornette.
"RobinS" <Ro****@NoSpam.yah.nonea écrit dans le message de
news:vI******************************@comcast.com. ..
>>I don't understand what you mean.

Does your stored procedure generate values in the table in SQLServer? Or
are you trying to write data to the table in SQLServer? Or do you have
data in the table in SQLServer, and are trying to read it?

Robin S.
------------------------------------

"Ornette" <abstrait...nospam...@free.frwrote in message
news:12**********************************@microso ft.com...
>>Hello,

I have a stored procedure which generates some values in the table.
When I use update() how to populate the dataset with theses values ?

For the moment I use output parameter but it just works for 1 row and
as the dataset doesn't have the value I should put it after and the
rowstate goes to "modified"...

Any ideas ?

SIncerly,


Mar 4 '07 #4

P: n/a
Hello,

(for info only)

My Create SP uses the auto id (generated bu sql server) combined with dates
and other tables contents to generate sort of "Custom Guid".
My Update SP generates date of modification and other parameters generated
from other tables.

I use a DataAdapter and it works as you said, except I need to put "Select
columns from table where id=@@identity" at the end for the dataset to be
filled with these generated values. If I don't add this select statement at
the end of the SP, the generated columns in database are not copied in the
dataset (that's normal).

Thank you for your comments.
"RobinS" <Ro****@NoSpam.yah.nonea écrit dans le message de
news:at******************************@comcast.com. ..
>I don't know how you're doing your updates, or what your SP looks like.

If you have a DataSet and are submitting the updates using a DataAdapter,
it iterates through the rows and performs each update/delete/insert as
needed, so it should retrieve the updated identity column value as it
goes.

Robin S.
---------------------------
"Ornette" <abstrait...nospam...@free.frwrote in message
news:A0**********************************@microsof t.com...
>Ok, sorry it was not so clear.

I have an update sotred procedure wich generates values in SQL Server.
I replaced the output parameted with a Select ... @@Identity at the end
of the procedure.
It seems ok, but I don't know what exaclty will happen when I will send
an entire dataset with multiples row added, modified and deleted to the
Update() function (which calls Insert, Update and Delete stored
procedures)...

Ornette.
"RobinS" <Ro****@NoSpam.yah.nonea écrit dans le message de
news:vI******************************@comcast.com ...
>>>I don't understand what you mean.

Does your stored procedure generate values in the table in SQLServer? Or
are you trying to write data to the table in SQLServer? Or do you have
data in the table in SQLServer, and are trying to read it?

Robin S.
------------------------------------

"Ornette" <abstrait...nospam...@free.frwrote in message
news:12**********************************@micros oft.com...
Hello,

I have a stored procedure which generates some values in the table.
When I use update() how to populate the dataset with theses values ?

For the moment I use output parameter but it just works for 1 row and
as the dataset doesn't have the value I should put it after and the
rowstate goes to "modified"...

Any ideas ?

SIncerly,


Mar 5 '07 #5

P: n/a
Oh, I see, you're talking about regenerating all of your columns. I don't
see why it wouldn't work. You've gotten it to work now?

Robin S.
----------------------------------------
"Ornette" <abstrait...nospam...@free.frwrote in message
news:BE**********************************@microsof t.com...
Hello,

(for info only)

My Create SP uses the auto id (generated bu sql server) combined with
dates and other tables contents to generate sort of "Custom Guid".
My Update SP generates date of modification and other parameters
generated from other tables.

I use a DataAdapter and it works as you said, except I need to put
"Select columns from table where id=@@identity" at the end for the
dataset to be filled with these generated values. If I don't add this
select statement at the end of the SP, the generated columns in database
are not copied in the dataset (that's normal).

Thank you for your comments.
"RobinS" <Ro****@NoSpam.yah.nonea écrit dans le message de
news:at******************************@comcast.com. ..
>>I don't know how you're doing your updates, or what your SP looks like.

If you have a DataSet and are submitting the updates using a
DataAdapter, it iterates through the rows and performs each
update/delete/insert as needed, so it should retrieve the updated
identity column value as it goes.

Robin S.
---------------------------
"Ornette" <abstrait...nospam...@free.frwrote in message
news:A0**********************************@microso ft.com...
>>Ok, sorry it was not so clear.

I have an update sotred procedure wich generates values in SQL Server.
I replaced the output parameted with a Select ... @@Identity at the end
of the procedure.
It seems ok, but I don't know what exaclty will happen when I will send
an entire dataset with multiples row added, modified and deleted to the
Update() function (which calls Insert, Update and Delete stored
procedures)...

Ornette.
"RobinS" <Ro****@NoSpam.yah.nonea écrit dans le message de
news:vI******************************@comcast.co m...
I don't understand what you mean.

Does your stored procedure generate values in the table in SQLServer?
Or are you trying to write data to the table in SQLServer? Or do you
have data in the table in SQLServer, and are trying to read it?

Robin S.
------------------------------------

"Ornette" <abstrait...nospam...@free.frwrote in message
news:12**********************************@micro soft.com...
Hello,
>
I have a stored procedure which generates some values in the table.
When I use update() how to populate the dataset with theses values ?
>
For the moment I use output parameter but it just works for 1 row and
as the dataset doesn't have the value I should put it after and the
rowstate goes to "modified"...
>
Any ideas ?
>
SIncerly,


Mar 5 '07 #6

P: n/a
Robin,

Yes it works great !
My only "problem" is that I don't know if the select (at the end of Update
SP and Create SP) is called for each row, or at the end for everything,
or...? because I don't know howUpdate() method of DataAdapter calls SQL
Server (create a DS for update, create a DS for Insert then combine it ?).

I will try to see it with the SQL profiler

"RobinS" <Ro****@NoSpam.yah.nonea écrit dans le message de
news:KK******************************@comcast.com. ..
Oh, I see, you're talking about regenerating all of your columns. I don't
see why it wouldn't work. You've gotten it to work now?

Robin S.
----------------------------------------
"Ornette" <abstrait...nospam...@free.frwrote in message
news:BE**********************************@microsof t.com...
>Hello,

(for info only)

My Create SP uses the auto id (generated bu sql server) combined with
dates and other tables contents to generate sort of "Custom Guid".
My Update SP generates date of modification and other parameters
generated from other tables.

I use a DataAdapter and it works as you said, except I need to put
"Select columns from table where id=@@identity" at the end for the
dataset to be filled with these generated values. If I don't add this
select statement at the end of the SP, the generated columns in database
are not copied in the dataset (that's normal).

Thank you for your comments.
"RobinS" <Ro****@NoSpam.yah.nonea écrit dans le message de
news:at******************************@comcast.com ...
>>>I don't know how you're doing your updates, or what your SP looks like.

If you have a DataSet and are submitting the updates using a
DataAdapter, it iterates through the rows and performs each
update/delete/insert as needed, so it should retrieve the updated
identity column value as it goes.

Robin S.
---------------------------
"Ornette" <abstrait...nospam...@free.frwrote in message
news:A0**********************************@micros oft.com...
Ok, sorry it was not so clear.

I have an update sotred procedure wich generates values in SQL Server.
I replaced the output parameted with a Select ... @@Identity at the end
of the procedure.
It seems ok, but I don't know what exaclty will happen when I will send
an entire dataset with multiples row added, modified and deleted to the
Update() function (which calls Insert, Update and Delete stored
procedures)...

Ornette.
"RobinS" <Ro****@NoSpam.yah.nonea écrit dans le message de
news:vI******************************@comcast.c om...
>I don't understand what you mean.
>
Does your stored procedure generate values in the table in SQLServer?
Or are you trying to write data to the table in SQLServer? Or do you
have data in the table in SQLServer, and are trying to read it?
>
Robin S.
------------------------------------
>
"Ornette" <abstrait...nospam...@free.frwrote in message
news:12**********************************@micr osoft.com...
>Hello,
>>
>I have a stored procedure which generates some values in the table.
>When I use update() how to populate the dataset with theses values ?
>>
>For the moment I use output parameter but it just works for 1 row and
>as the dataset doesn't have the value I should put it after and the
>rowstate goes to "modified"...
>>
>Any ideas ?
>>
>SIncerly,
>
>

Mar 5 '07 #7

P: n/a
The Update method of the DataAdapter calls SQLServer one row at a time. It
checks the RowState; if it's an insert, it uses the InsertCommand; if it's
an update, it uses the Update Command, and so on. So you should be okay.

Robin S.
----------------------------
"Ornette" <abstrait...nospam...@free.frwrote in message
news:8F**********************************@microsof t.com...
Robin,

Yes it works great !
My only "problem" is that I don't know if the select (at the end of
Update SP and Create SP) is called for each row, or at the end for
everything, or...? because I don't know howUpdate() method of DataAdapter
calls SQL Server (create a DS for update, create a DS for Insert then
combine it ?).

I will try to see it with the SQL profiler

"RobinS" <Ro****@NoSpam.yah.nonea écrit dans le message de
news:KK******************************@comcast.com. ..
>Oh, I see, you're talking about regenerating all of your columns. I
don't see why it wouldn't work. You've gotten it to work now?

Robin S.
----------------------------------------
"Ornette" <abstrait...nospam...@free.frwrote in message
news:BE**********************************@microso ft.com...
>>Hello,

(for info only)

My Create SP uses the auto id (generated bu sql server) combined with
dates and other tables contents to generate sort of "Custom Guid".
My Update SP generates date of modification and other parameters
generated from other tables.

I use a DataAdapter and it works as you said, except I need to put
"Select columns from table where id=@@identity" at the end for the
dataset to be filled with these generated values. If I don't add this
select statement at the end of the SP, the generated columns in
database are not copied in the dataset (that's normal).

Thank you for your comments.
"RobinS" <Ro****@NoSpam.yah.nonea écrit dans le message de
news:at******************************@comcast.co m...
I don't know how you're doing your updates, or what your SP looks like.

If you have a DataSet and are submitting the updates using a
DataAdapter, it iterates through the rows and performs each
update/delete/insert as needed, so it should retrieve the updated
identity column value as it goes.

Robin S.
---------------------------
"Ornette" <abstrait...nospam...@free.frwrote in message
news:A0**********************************@micro soft.com...
Ok, sorry it was not so clear.
>
I have an update sotred procedure wich generates values in SQL
Server.
I replaced the output parameted with a Select ... @@Identity at the
end of the procedure.
It seems ok, but I don't know what exaclty will happen when I will
send an entire dataset with multiples row added, modified and deleted
to the Update() function (which calls Insert, Update and Delete
stored procedures)...
>
Ornette.
>
>
"RobinS" <Ro****@NoSpam.yah.nonea écrit dans le message de
news:vI******************************@comcast. com...
>>I don't understand what you mean.
>>
>Does your stored procedure generate values in the table in
>SQLServer? Or are you trying to write data to the table in
>SQLServer? Or do you have data in the table in SQLServer, and are
>trying to read it?
>>
>Robin S.
>------------------------------------
>>
>"Ornette" <abstrait...nospam...@free.frwrote in message
>news:12**********************************@mic rosoft.com...
>>Hello,
>>>
>>I have a stored procedure which generates some values in the table.
>>When I use update() how to populate the dataset with theses values
>>?
>>>
>>For the moment I use output parameter but it just works for 1 row
>>and as the dataset doesn't have the value I should put it after and
>>the rowstate goes to "modified"...
>>>
>>Any ideas ?
>>>
>>SIncerly,
>>
>>
>


Mar 6 '07 #8

P: n/a
OK, thank you. I've just tested it with great success.

"RobinS" <Ro****@NoSpam.yah.nonea écrit dans le message de
news:97******************************@comcast.com. ..
The Update method of the DataAdapter calls SQLServer one row at a time. It
checks the RowState; if it's an insert, it uses the InsertCommand; if it's
an update, it uses the Update Command, and so on. So you should be okay.

Robin S.
----------------------------
"Ornette" <abstrait...nospam...@free.frwrote in message
news:8F**********************************@microsof t.com...
>Robin,

Yes it works great !
My only "problem" is that I don't know if the select (at the end of
Update SP and Create SP) is called for each row, or at the end for
everything, or...? because I don't know howUpdate() method of DataAdapter
calls SQL Server (create a DS for update, create a DS for Insert then
combine it ?).

I will try to see it with the SQL profiler

"RobinS" <Ro****@NoSpam.yah.nonea écrit dans le message de
news:KK******************************@comcast.com ...
>>Oh, I see, you're talking about regenerating all of your columns. I
don't see why it wouldn't work. You've gotten it to work now?

Robin S.
----------------------------------------
"Ornette" <abstrait...nospam...@free.frwrote in message
news:BE**********************************@micros oft.com...
Hello,

(for info only)

My Create SP uses the auto id (generated bu sql server) combined with
dates and other tables contents to generate sort of "Custom Guid".
My Update SP generates date of modification and other parameters
generated from other tables.

I use a DataAdapter and it works as you said, except I need to put
"Select columns from table where id=@@identity" at the end for the
dataset to be filled with these generated values. If I don't add this
select statement at the end of the SP, the generated columns in
database are not copied in the dataset (that's normal).

Thank you for your comments.
"RobinS" <Ro****@NoSpam.yah.nonea écrit dans le message de
news:at******************************@comcast.c om...
>I don't know how you're doing your updates, or what your SP looks like.
>
If you have a DataSet and are submitting the updates using a
DataAdapter, it iterates through the rows and performs each
update/delete/insert as needed, so it should retrieve the updated
identity column value as it goes.
>
Robin S.
---------------------------
"Ornette" <abstrait...nospam...@free.frwrote in message
news:A0**********************************@micr osoft.com...
>Ok, sorry it was not so clear.
>>
>I have an update sotred procedure wich generates values in SQL
>Server.
>I replaced the output parameted with a Select ... @@Identity at the
>end of the procedure.
>It seems ok, but I don't know what exaclty will happen when I will
>send an entire dataset with multiples row added, modified and deleted
>to the Update() function (which calls Insert, Update and Delete
>stored procedures)...
>>
>Ornette.
>>
>>
>"RobinS" <Ro****@NoSpam.yah.nonea écrit dans le message de
>news:vI******************************@comcast .com...
>>>I don't understand what you mean.
>>>
>>Does your stored procedure generate values in the table in
>>SQLServer? Or are you trying to write data to the table in
>>SQLServer? Or do you have data in the table in SQLServer, and are
>>trying to read it?
>>>
>>Robin S.
>>------------------------------------
>>>
>>"Ornette" <abstrait...nospam...@free.frwrote in message
>>news:12**********************************@mi crosoft.com...
>>>Hello,
>>>>
>>>I have a stored procedure which generates some values in the table.
>>>When I use update() how to populate the dataset with theses values
>>>?
>>>>
>>>For the moment I use output parameter but it just works for 1 row
>>>and as the dataset doesn't have the value I should put it after and
>>>the rowstate goes to "modified"...
>>>>
>>>Any ideas ?
>>>>
>>>SIncerly,
>>>
>>>
>>
>
>

Mar 6 '07 #9

This discussion thread is closed

Replies have been disabled for this discussion.