I would like to have a button wherein I can browse an excel file. I want the data inside to be inserted to my mysql database. I already have a button and it can already browse and select a file. I am having problems when it comes to inserting the data which is inside the excel to the mysql database.
Dim fname As String = label1.Text
Try
If label1.Text = "" Then
Else
' Code to Import from Excel in to database.
Dim dbFileName As String = fname
Dim insertSql As String = "INSERT INTO tbl1 SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;HDR=yes;Database=" + dbFileName + "',[Sheet1$])"
MySqlCmd = New MySqlCommand
MySqlCmd.Connection = Myconnect
MySqlCmd.CommandText = insertSql
MySqlCmd.ExecuteNonQuery()
MsgBox("import successful")
End If
Catch ex As Exception
End Try
This is what i have searched and tried so far but it the inserting part is not working.
I am having problems...show the code you are using and exactly what the problems are. We have no where to start with that vague description