473,387 Members | 1,504 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,387 software developers and data experts.

Create Update DS

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
8 1605
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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Rustam Bogubaev | last post by:
Hi, I have a table with the following columns: ID INTEGEDR, Name VARCHAR(32), Surname VARCHAR(32), GroupID INTEGER, SubGroupOneID INTEGER, SubGroupTwoID...
1
by: efinney | last post by:
Hi, I'm a newbie to sql server and this may be a really dumb question for some you. I'm trying to find some examples of sql server triggers that will set columns (e.g. the created and modified...
1
by: Barbara Lindsey | last post by:
I am a postgres newbie. I am trying to create a trigger that will put a copy of a record into a backup table before update or delete. As I understand it, in order to do this I must have a...
7
by: Patrick Fisher | last post by:
Hi I have a table which Contains entries with RefCode field containing INVP or INVPD Common fields in each entry would be InvoiceNo, Total and PurTyp for example. You could have ...
0
by: Solution Seeker | last post by:
Hi, We are using vb.net for creating a Windows Application. We are using layered approach, with a UI layer, Logic, Db Access layer etc. we are encountering a peculiar problem when we try to...
2
by: masri999 | last post by:
I have a requirement in SQL 2005 in Development database 1. Schema dbo owns all objects (tables,views,SPs,UDFs etc) . 2. Only DBA's ( who are database owners ) can create, alter tables ....
27
by: max | last post by:
Hello, I am a newbye, and I'm trying to write a simple application. I have five tables with three columns; all tables are identical; I need to change some data in the first table and let VB...
6
by: Alvin SIU | last post by:
Hi all, I have a table in Db2 v8 like this: Team Name Role ------ -------- --------------------- A Superman Leader A Batman Member A WonderWoman Member B ...
2
by: DragonLord | last post by:
Ok basically this is mostly working, What i want to do is create an xml file with multiple updates that have the same attribute. <root> <update> <element1>value</element1> ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.