PC Review Forums Newsgroups Microsoft DotNet Microsoft ADO .NET Re: ADO.NET dataset help

Reply

Re: ADO.NET dataset help

 
Thread Tools Rate Thread
Old 30-06-2003, 12:30 PM   #1
Scot Rose [MSFT]
Guest
 
Posts: n/a
Default Re: ADO.NET dataset help


Yes, You would have to copy the data row by row from one dataset to the other. Now another possibility is something like this (The jet provider lets you get away with alot) but I do
not know if this will work with DB2 (Never tried this with DB2 but it works great with SQL Server) This inserts the data directly from the ODBC DataSource into a table in a Jet
database (No Datasets or recordsets involved). ALMOST as good a DTS with SQL Server<G>

(The following is VB6 code, but you should get the idea and be able to easily modify it using the Jet OLEDB Provider and the OLDBDataAdapter in vb.Net)

Dim Rs As ADODB.Recordset
Dim cn As ADODB.Connection

Private Sub Form_Load()
Dim cn As ADODB.Connection
Dim strSQL As String
Set cn = New ADODB.Connection
cn.CursorLocation = adUseClient
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\northwind.mdb"

strSQL = "Insert INTO Products(ProductName,SupplierID," _
& "CategoryID,QuantityPerUnit,UnitPrice,UnitsInStock,UnitsOnOrder,ReorderLevel," _
& "Discontinued) select ProductName,SupplierID" _
& ",CategoryID,QuantityPerUnit,UnitPrice,UnitsInStock,UnitsOnOrder" _
& ",ReorderLevel,Discontinued FROM [ODBC;Driver={SQL Server};Database=Northwind;" _
& "Server=MyServer;uid=sa;pwd=Password1;].[products]"

cn.Execute strSQL

Set cn = Nothing

End Sub

Want to know more? Check out the MSDN Library at http://msdn.microsoft.com or the Microsoft Knowledge Base at http://support.microsoft.com

Scot Rose, MCSD
Microsoft Visual Basic Developer Support
Email : scotr@online.microsoft.com <Remove word online. from address>

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




--------------------
>From: Michael Wiley <mlwiley@arkbluecross.com>
>References: <eDEvgwxODHA.3836@tk2msftngp13.phx.gbl>
>X-Newsreader: AspNNTP 1.50 (ActionJackson.com)
>Subject: Re: ADO.NET dataset help
>Mime-Version: 1.0
>Content-Type: text/plain; charset="us-ascii"
>Content-Transfer-Encoding: 7bit
>Message-ID: <eq2VM3xODHA.1216@TK2MSFTNGP11.phx.gbl>
>Newsgroups: microsoft.public.dotnet.framework.adonet
>Date: Wed, 25 Jun 2003 06:29:24 -0700
>NNTP-Posting-Host: actionjackson133.dsl.frii.net 216.17.147.133
>Lines: 1
>Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
>Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.adonet:54234
>X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
>
>
>Thank you for your help. However, I do have a couple more questions.
>
>1. How would I fill one dataset from Access with the dataset from DB/2?
>Sample code would help. Could I just use the .Copy command from the
>db/2 dataset and set it equal to the access dataset?
>
>2. If I did your steps, are you saying it's STILL writing it row by
>row, thus not increasing performance?
>
>Yes - the goal is periodic movement of data from DB/2 to Access. We do
>not have SQL Server anywhere yet.
>
>Again, thank you for your help.
>
>
>*** Sent via Developersdex http://www.developersdex.com ***
>Don't just participate in USENET...get rewarded for it!
>



  Reply With Quote
Old 01-07-2003, 11:18 AM   #2
Michael Wiley
Guest
 
Posts: n/a
Default Re: ADO.NET dataset help

Thank you for your response. I think I will try that. I did not know
that info, and it looks like a cool trick.



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off