-----------------------------------------------------------

New Message on MumbaiUserGroup

-----------------------------------------------------------
From: sooryakumar
Message 6 in Discussion



Hi

I populated the dataset from one datasource. Now i want to persist this dataset into a 
different datasource. I have written the code below for that.

Dim strUpdateSQL As String

Dim strUpdateConn As String

Dim objUpdateConn As OleDbConnection

Dim objUpdateDA As OleDbDataAdapter

strUpdateConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data 
Source=C:\Soorya\RAP\Reinsurance Calculation.mdb;User Id=admin;Password=;"

strUpdateSQL = "INSERT INTO TABLE1 "

strUpdateSQL = strUpdateSQL + " (CODE, DESCRIPTION)"

strUpdateSQL = strUpdateSQL + " Values (?, ?)"

''CREATE THE CONNECTION OBJECT

objUpdateConn = New OleDbConnection(strUpdateConn)

''OPEN CONNECTION

objUpdateConn.Open()

''CREATE THE DATA ADAPTER OBJECT

objUpdateDA = New OleDbDataAdapter(strUpdateSQL, objUpdateConn)

objUpdateDA.AcceptChangesDuringFill = False

''UPDATE THE DATA SOURCE

Console.WriteLine(objUpdateDA.Update(objDS, "COMPANY_MASTER"))



But i am getting the System.InvalidOperationException Error. Additional information is 
follows.

"Update requires a valid InsertCommand when passed DataRow collection with new Rows"


So can anybody please tell me how my insert statement should be..

Thanks and Regards



Sooryakumar.S  

Courage in danger is half the battle won.
From: "sooryakumar" <[EMAIL PROTECTED]> Reply-To: "MumbaiUserGroup" <[EMAIL 
PROTECTED]> To: [EMAIL PROTECTED] Subject: Re: Excel in VB.NET Date: Mon, 29 Mar 2004 
19:42:34 -0800 
Apply to 50,000 jobs now. Post your CV on naukri.com today. 

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/mumbaiusergroup/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to