saving data to dataTable

B

Bruce L. Scheffler

I have a form that I have placed an sqlconnect,
sqladapter, and created an dataset. I have no problem
filling the dataset, the fields have are binded to the
table; however when I try to save the data after changes
have been made no update is done to the orginal table. I
can see in the SqlDataAdapter the code has been written
for all the different commands including the update
command. What am I doing wrong?
 
R

Roy Osherove

I have a form that I have placed an sqlconnect,
sqladapter, and created an dataset. I have no problem
filling the dataset, the fields have are binded to the
table; however when I try to save the data after changes
have been made no update is done to the orginal table. I
can see in the SqlDataAdapter the code has been written
for all the different commands including the update
command. What am I doing wrong?

try looking in the SQL profiler and see if any update commands actually
reach the server.
 
Y

Ying-Shen Yu[MSFT]

Hi Bruce,

Thanks for your post!

I aggree with Roy, it seems the update command is not actually executed on
the sql server.
You may re-run the Genereate data wizard, and check if the UPDATE command
is genereated
successfully.

If it is all successful and the problem still exists, you may send me a
small project to reproduce your problem. I'll look into it.
Thanks!




Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
You should not reply this mail directly, "Online" should be removed before
sending.

--------------------
| Content-Class: urn:content-classes:message
| From: "Bruce L. Scheffler" <[email protected]>
| Sender: "Bruce L. Scheffler" <[email protected]>
| Subject: saving data to dataTable
| Date: Wed, 12 Nov 2003 04:02:23 -0800
| Lines: 8
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcOpFNUNkGcRh3gPSceX6yuwaOa7mQ==
| Newsgroups: microsoft.public.dotnet.framework.windowsforms
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.windowsforms:56349
| NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
| X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
|
| I have a form that I have placed an sqlconnect,
| sqladapter, and created an dataset. I have no problem
| filling the dataset, the fields have are binded to the
| table; however when I try to save the data after changes
| have been made no update is done to the orginal table. I
| can see in the SqlDataAdapter the code has been written
| for all the different commands including the update
| command. What am I doing wrong?
|
 
Y

Ying-Shen Yu[MSFT]

Hi Bruce,

I think you had known this, just a kind remind,
You need call SqlDataAdapter.Update method and provide the correct dataset
for it.
Thanks!

Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
You should not reply this mail directly, "Online" should be removed before
sending.

--------------------
| Newsgroups: microsoft.public.dotnet.framework.windowsforms
| From: (e-mail address removed) ("Ying-Shen Yu[MSFT]")
| Organization: Microsoft
| Date: Thu, 13 Nov 2003 08:22:49 GMT
| Subject: RE: saving data to dataTable
| X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
|
| Hi Bruce,
|
| Thanks for your post!
|
| I aggree with Roy, it seems the update command is not actually executed
on
| the sql server.
| You may re-run the Genereate data wizard, and check if the UPDATE command
| is genereated
| successfully.
|
| If it is all successful and the problem still exists, you may send me a
| small project to reproduce your problem. I'll look into it.
| Thanks!
|
|
|
|
| Best regards,
|
| Ying-Shen Yu [MSFT]
| Microsoft Online Partner Support
| Get Secure! - www.microsoft.com/security
|
| This posting is provided "AS IS" with no warranties and confers no rights.
| You should not reply this mail directly, "Online" should be removed
before
| sending.
|
| --------------------
| | Content-Class: urn:content-classes:message
| | From: "Bruce L. Scheffler" <[email protected]>
| | Sender: "Bruce L. Scheffler" <[email protected]>
| | Subject: saving data to dataTable
| | Date: Wed, 12 Nov 2003 04:02:23 -0800
| | Lines: 8
| | Message-ID: <[email protected]>
| | MIME-Version: 1.0
| | Content-Type: text/plain;
| | charset="iso-8859-1"
| | Content-Transfer-Encoding: 7bit
| | X-Newsreader: Microsoft CDO for Windows 2000
| | X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| | Thread-Index: AcOpFNUNkGcRh3gPSceX6yuwaOa7mQ==
| | Newsgroups: microsoft.public.dotnet.framework.windowsforms
| | Path: cpmsftngxa06.phx.gbl
| | Xref: cpmsftngxa06.phx.gbl
| microsoft.public.dotnet.framework.windowsforms:56349
| | NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
| | X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
| |
| | I have a form that I have placed an sqlconnect,
| | sqladapter, and created an dataset. I have no problem
| | filling the dataset, the fields have are binded to the
| | table; however when I try to save the data after changes
| | have been made no update is done to the orginal table. I
| | can see in the SqlDataAdapter the code has been written
| | for all the different commands including the update
| | command. What am I doing wrong?
| |
|
 
B

Bruce L. Scheffler

Sir,
That seems to be the problem here is the actual code I use
on the click event for saving...

this.sqlDataAdapter.Update(this.DataSet1,"Setup");
this.close();

Note I tried adding this.sqlDataAdapter.AcceptChanges
prior to the update line but it made no difference. When
I add a try/exception it does not return any errors...

Does this help?
(By the way I do appreciate all the advice everyone has
given, one of the many reasons I enjoy programming in .net
is the friendly attitude eveyone has in helping...)
:)Bruce...
-----Original Message-----
Hi Bruce,

I think you had known this, just a kind remind,
You need call SqlDataAdapter.Update method and provide the correct dataset
for it.
Thanks!

Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
You should not reply this mail directly, "Online" should be removed before
sending.

--------------------
| Newsgroups: microsoft.public.dotnet.framework.windowsforms
| From: (e-mail address removed) ("Ying-Shen Yu[MSFT]")
| Organization: Microsoft
| Date: Thu, 13 Nov 2003 08:22:49 GMT
| Subject: RE: saving data to dataTable
| X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
|
| Hi Bruce,
|
| Thanks for your post!
|
| I aggree with Roy, it seems the update command is not actually executed
on
| the sql server.
| You may re-run the Genereate data wizard, and check if the UPDATE command
| is genereated
| successfully.
|
| If it is all successful and the problem still exists, you may send me a
| small project to reproduce your problem. I'll look into it.
| Thanks!
|
|
|
|
| Best regards,
|
| Ying-Shen Yu [MSFT]
| Microsoft Online Partner Support
| Get Secure! - www.microsoft.com/security
|
| This posting is provided "AS IS" with no warranties and confers no rights.
| You should not reply this mail directly, "Online" should be removed
before
| sending.
|
| --------------------
| | Content-Class: urn:content-classes:message
| | From: "Bruce L. Scheffler"
 
Y

Ying-Shen Yu[MSFT]

Hi Bruce,

Thanks for your reply!

I'll try my best to help you. First we need to know if the SQL update
command has been sent to the SQL Server. I'd like you try the SQL Profiler
to check if the UPDATE command is actually executed on SQL server side. You
may follow the steps below:
1. open the Profiler, and select "File"->"New"->"Trace"
2. connect to that SQL Server, you needn't modify the "TraceProperties"
dialog, just click "Run" button.
3. run your program and click the update button,
4. Select "File"->"Save" in the menu to save the trace file.

please send the trace file to me by e-mail . I'll look into it
Thanks!

Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
You should not reply this mail directly, "Online" should be removed before
sending.
 
B

Bruce L. Scheffler

I have sent you the files per your request. I really
appreciate all your assistance...
:)Bruce...
 
Y

Ying-Shen Yu[MSFT]

Hi Bruce,

Thanks for your tracelog and code.

You may try add the following line before calling the update method.
BindingContext[dataSet11,"NameID"].EndCurrentEdit();

Does it solve your problem?
If yes, I think it's probably because, in-databinding values are updated to
dataset when you move off the current row, or you need end the edit mode on
current row explitely.

To know more about .NET Databinding, you may get more information on
databinding on
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/
vboriwindowsformsdataarchitecture.asp

Thanks! This doesn't resolve your problem , please be free to reply to this
thread to let me know.

Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
You should not reply this mail directly, "Online" should be removed before
sending.
 
B

Bruce L. Scheffler

BINGO!
That was it! Thanks so much for your support and
assistance, you just saved me a ton of effort...
:)Bruce...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top