|
-
Apr 22nd, 2008, 07:45 PM
#1
Thread Starter
Junior Member
Help!! problem Update Mysql database
Hi everyone,
I have problem updating mysql databse. I need to export data from excel files and then update it to mysql database. I am using dataset and odbc dataadapter to do so. below is my coding. There is no error but the databse is nver updated..................I have stuck here for 2 days!!! Please help!! Below is my codes..
Dim cnn As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\cheekon1\My Documents\Imported data\QIS.xls;Extended Properties=""Excel 8.0;HDR=YES;""")
Dim da As New OleDb.OleDbDataAdapter("Select part_asset_num, part_ag_model_num,part_serial_num,part_model_num,part_parent_serial_num from [Asset$]", cnn)
Dim mysql As New Odbc.OdbcConnection("DSN=mysql;DATABASE=tracking;UID=root;PASSWORD=admin1;OPTION=3;")
Dim da2 As New OdbcDataAdapter("SELECT * FROM part", mysql)
Dim ds As New DataSet
Dim ds2 As New DataSet
Dim i As Integer
MySql.Open()
da.Fill(ds, "TestExcel")
da2.Fill(ds2, "Part")
da2.FillSchema(ds2, SchemaType.Source, "Part")
For i = 0 To ds.Tables("TestExcel").Rows.Count - 1
ds2.Tables("Part").ImportRow(ds.Tables("TestExcel").Rows(i))
Next
Console.WriteLine(ds2.Tables("Part").Rows.Count)
da2.Update(ds2, "part")
MySql.Close()
Last edited by keon2005; Apr 23rd, 2008 at 02:02 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|