473,769 Members | 2,382 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1631
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...nos pam...@free.frw rote 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 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...nos pam...@free.frw rote 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 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...nos pam...@free.frw rote in message
news:A0******** *************** ***********@mic rosoft.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...nos pam...@free.frw rote 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 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...nos pam...@free.frw rote in message
news:A0******** *************** ***********@mic rosoft.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******* *************** ********@comcas t.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...nos pam...@free.frw rote in message
news:12****** *************** *************@m icrosoft.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...nos pam...@free.frw rote in message
news:BE******** *************** ***********@mic rosoft.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...nos pam...@free.frw rote in message
news:A0******* *************** ************@mi crosoft.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****** *************** *********@comca st.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...nos pam...@free.frw rote in message
news:12***** *************** **************@ microsoft.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...nos pam...@free.frw rote in message
news:BE******** *************** ***********@mic rosoft.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******* *************** ********@comcas t.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...nos pam...@free.frw rote in message
news:A0****** *************** *************@m icrosoft.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***** *************** **********@comc ast.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...nos pam...@free.frw rote in message
news:12**** *************** *************** @microsoft.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...nos pam...@free.frw rote in message
news:8F******** *************** ***********@mic rosoft.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...nos pam...@free.frw rote in message
news:BE******* *************** ************@mi crosoft.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****** *************** *********@comca st.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
DataAdapte r, 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...nos pam...@free.frw rote in message
news:A0***** *************** **************@ microsoft.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**** *************** ***********@com cast.com...
>>I don't understand what you mean.
>>
>Does your stored procedure generate values in the table in
>SQLServe r? Or are you trying to write data to the table in
>SQLServe r? Or do you have data in the table in SQLServer, and are
>trying to read it?
>>
>Robin S.
>------------------------------------
>>
>"Ornette " <abstrait...nos pam...@free.frw rote in message
>news:12*** *************** *************** *@microsoft.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 ?
>>>
>>SIncerl y,
>>
>>
>


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...nos pam...@free.frw rote in message
news:8F******** *************** ***********@mic rosoft.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******* *************** ********@comcas t.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...nos pam...@free.frw rote in message
news:BE****** *************** *************@m icrosoft.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***** *************** **********@comc ast.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...nos pam...@free.frw rote in message
news:A0**** *************** *************** @microsoft.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*** *************** ************@co mcast.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.
>>------------------------------------
>>>
>>"Ornett e" <abstrait...nos pam...@free.frw rote in message
>>news:12** *************** *************** **@microsoft.co m...
>>>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
5312
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 INTEGER
1
17342
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 date columns) if the row is being inserted and set a column (e.g. just the modified date column) if the row is being updated. I know how to do this in oracle plsql. I would define it as a before insert or update trigger and reference old and new...
1
4461
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 function created to do this task. The function I am trying to create is as follows: CREATE FUNCTION customer_bak_proc(integer) RETURNS boolean as 'INSERT INTO customer_bak (SELECT * from customer where id = $1 )' LANGUAGE 'SQL';
7
1788
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 1001 500.50 INVP 1 1001 500.50 INVPID 1 1002 123.00 INVP 1
0
948
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 perform an Create to one table followed by update to another table . for e.g. user hits save in a window/screen.
2
22621
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 . Developer's should not create or alter tables . 3. Developers can create/alter Stored Procedure/User Defined functions in dbo schema and can execute SP/UDF. 4. Developers should have SELECT,INSERT,DELETE,UPDATE on tables ( tables in dbo schema
27
3793
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 updates the same data in all other four tables in the right places. I know it would be possible by using the ForeignKeyConstraint object. I have created the tables using the DataSet Visual Tool and I know it doesn't create any ForeignKeyConstraint obj....
6
4320
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 Alvin Leader
2
5249
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> <element2>value</element2> <element3>value</element3> <element4>value</element4>
0
9586
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10210
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9990
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8869
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5298
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.