Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Try
- Dim conn As New Connection
- Dim rset As New Recordset
- Dim buff0 As String
- Dim buff1 As String
- Dim buff2 As String
- Dim buff3 As String
- Dim buff4 As String
- Dim buff5 As String
- conn.ConnectionString = "Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DriverId=790;Dbq=" & TextBox1.Text & ";" 'Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=d:\temp\test.xls;"
- conn.Open()
- rset.Open("select * from [Sheet1$]", conn, CursorTypeEnum.adOpenForwardOnly)
- Do Until rset.EOF
- buff0 = rset(0).Value
- buff1 = rset(1).Value
- buff2 = rset(2).Value
- buff3 = rset(3).Value
- buff4 = rset(4).Value
- buff5 = rset(5).Value
- Call connection_string()
- MysqlConn.Open()
- Query = "INSERT INTO tbl1 VALUES('" & buff0 & "','" & buff1 & "','" & buff2 & "','" & buff3 & "','" & buff4 & "','" & buff5 & "')"
- COMMAND = New MySqlCommand(Query, MysqlConn)
- COMMAND.ExecuteNonQuery()
- rset.MoveNext()
- Loop
- MsgBox("Import Successful!", MsgBoxStyle.Information, Title:="SOMS")
- Catch ex As Exception
- MsgBox("Import Unsuccessful!", MsgBoxStyle.Critical, Title:="SOMS")
- End Try
Add Comment
Please, Sign In to add comment