[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.odbcnet

Updating SQL Server From a Dataset

jonnylbluejeans

8/2/2002 9:15:00 PM

I have a dataset that has the same columns as a DB table that I need to
update. Is there an easy way to insert all the records of the dataset
into the table - without cycling through the recordset and creating
INSERT statments?
3 Answers

(Hussein Abuthuraya(MSFT))

8/3/2002 12:13:00 AM

0

The short answer is No in this version. However, I heard that Development is considering adding a Bulk-Copy feature in the future. When and in what version, not sure but we
are aware that this is a frequently requested feature.

For now, you have to do it the manual way as you already know. If your database is SQL Server, you may want to download the SQLXML 3.0 provider from the MSDN. This
provider has some Bulk-copy features but for XML files. In your case, you may save the dataset to an XML file and then try the "SQL Server XML Bulk Load Object Model".


Thanks,
Hussein Abuthuraya
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.

Are you secure? For information about the Microsoft Strategic Technology Protection Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.co....


jonnylbluejeans

8/6/2002 5:50:00 PM

0

In article <yM9B7GnOCHA.2248@cpmsftngxa07>, HussAbOnline@microsoft.com
says...
> The short answer is No in this version. However, I heard that Development is considering adding a Bulk-Copy feature in the future. When and in what version, not sure but we
> are aware that this is a frequently requested feature.
>
> For now, you have to do it the manual way as you already know. If your database is SQL Server, you may want to download the SQLXML 3.0 provider from the MSDN. This
> provider has some Bulk-copy features but for XML files. In your case, you may save the dataset to an XML file and then try the "SQL Server XML Bulk Load Object Model".
>
>
> Thanks,
> Hussein Abuthuraya
> Microsoft Developer Support
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> Are you secure? For information about the Microsoft Strategic Technology Protection Program and to order your FREE Security Tool Kit, please visit
> http://www.microsoft.co....
>
>
>

Is there anyway I can make use of the ODBCCommandBuilder? From the MSDN
documentation, it looks like I should be able to use it.

(Hussein Abuthuraya(MSFT))

8/6/2002 10:08:00 PM

0

As far as using the ODBCCommandBuilder, sure you could use it to build your Insert/Delete/Update command from the select command of the DataAdapter. However, the
RowState of each row has to be set to the proper value. For example, RowState="Added" will cause the DataAdapter's Update method to call the Insert command.
Similarly, it will the Delete command if the RowState=Deleted and the Update command if the RowState="Modified".

This is not going to help you with the bulk Copy that your original question is about because the DataAdapter will cycle through all the rows and based on the RowState will
call the approperiate command.


Thanks,
Hussein Abuthuraya
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.

Are you secure? For information about the Microsoft Strategic Technology Protection Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.co....