PC Review


Reply
Thread Tools Rate Thread

DataAdapter & SQLClient

 
 
Bonato Pierantonio
Guest
Posts: n/a
 
      8th Feb 2005
Hi All,
I have a problem.... I want to update a table in MS Sql Server using the
class SQLClient DataAdapter.
I can set the property UpdateCommand of my DA but I cannot find the method
UPDATE ( I use VB.NET)

I hope to be clear....

Thanks for your help
Bonato Pierantonio


 
Reply With Quote
 
 
 
 
=?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN
Guest
Posts: n/a
 
      8th Feb 2005
I can give you two choices:

1. Create either a SQL statement for update or a stored procedure and link
to the UpdateCommand property of the DataAdapter.

2. Use a CommandBuilder to create the UPDATE command off of your SELECT
command.


---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************

"Bonato Pierantonio" wrote:

> Hi All,
> I have a problem.... I want to update a table in MS Sql Server using the
> class SQLClient DataAdapter.
> I can set the property UpdateCommand of my DA but I cannot find the method
> UPDATE ( I use VB.NET)
>
> I hope to be clear....
>
> Thanks for your help
> Bonato Pierantonio
>
>
>

 
Reply With Quote
 
=?Utf-8?B?UElFQkFMRA==?=
Guest
Posts: n/a
 
      8th Feb 2005
Don't forget the Insert and Delete commands. (The CommandBuilder will take
care of them for you.)

But if the problem is just that the Update method doesn't show in
autocomplete then simply type it in and see if it compiles.

Here's some C# code I use to update a table (given a DataTable whose name
matches the source tablename):

System.Data.SqlClient.SqlDataAdapter dba = new
System.Data.SqlClient.SqlDataAdapter
(
"SELECT * FROM " + Subject.TableName
,
this.dbc.ConnectionString
) ;

System.Data.SqlClient.SqlCommandBuilder cb = new
System.Data.SqlClient.SqlCommandBuilder ( dba ) ;

dba.Update ( Subject ) ;

 
Reply With Quote
 
=?Utf-8?B?TWFucHJlZXQgU2luZ2g=?=
Guest
Posts: n/a
 
      14th Feb 2005
Hi,

If you have imported proper namespaces, as you are setting the UpdateCommand
property of the DA. Refresh the environment and you will definitely will be
able to use the Update method in right way.

Regards,


"Bonato Pierantonio" wrote:

> Hi All,
> I have a problem.... I want to update a table in MS Sql Server using the
> class SQLClient DataAdapter.
> I can set the property UpdateCommand of my DA but I cannot find the method
> UPDATE ( I use VB.NET)
>
> I hope to be clear....
>
> Thanks for your help
> Bonato Pierantonio
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
difference between dataAdapter.InsertCommand/dataAdapter.SelectCom =?Utf-8?B?UmljaA==?= Microsoft VB .NET 3 10th Nov 2006 03:34 PM
are System.Data.SqlClient.SqlConnection thread safe? can many threads share a System.Data.SqlClient.SqlConnection instance without any synchronization? Daniel Microsoft Dot NET Framework 6 24th Mar 2006 01:01 AM
are System.Data.SqlClient.SqlConnection thread safe? can many threads share a System.Data.SqlClient.SqlConnection instance without any synchronization? Daniel Microsoft Dot NET 2 22nd Mar 2006 07:01 PM
are System.Data.SqlClient.SqlConnection thread safe? can many threads share a System.Data.SqlClient.SqlConnection instance without any synchronization? Daniel Microsoft C# .NET 1 22nd Mar 2006 06:34 AM
BC30390: 'System.Data.SqlClient.SqlDataReader.Private Overloads Sub New(command As System.Data.SqlClient.SqlCommand)' is not accessible in this context because it is 'Private'. luke Microsoft ASP .NET 0 14th Mar 2004 05:21 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:28 AM.