NEED HELP~!
I want to create a openfiledialog and allow user to choose which exel file to be imported into the server but this error keep coming "ODBC--connection to '{SQL Server}'TGT102 failed".
Thank you so much~~
PS. I am just a beginner of vb.net. So would u pls tell me the solution in detail?
THANKS~~~!!

Try


Dim sqlstm2 As String = "truncate table fodmast"
ObjAcc.ExecNonquery(sqlstm2)
Dim sqlstm3 As String = "truncate table special_spec_order"
ObjAcc.ExecNonquery(sqlstm3)

Dim sqlstm As String = "drop table " & txtInsertedTableName.Text & ""
ObjAcc.ExecNonquery(sqlstm)
Catch ex As Exception

End Try

Try

Dim ExcelPath As String = txtexcelPath.Text.ToLower()
Dim Ext As String = _
ExcelPath.Substring(ExcelPath.LastIndexOf(".") + 1)
If File.Exists(ExcelPath) AndAlso (Ext.Equals("xls") _
Or Ext.Equals("xlsx")) Then
dm.importToServer(OpenFileDialog1.FileName, txtserver.Text, txtDbName.Text, txtusername.Text, txtpassword.Text, txtInsertedTableName.Text)
ProgressBar1.Visible = False
'MessageBox.Show("File imported successfully")
End If
Catch ex As Exception
ProgressBar1.Visible = False
MessageBox.Show(ex.Message)
Exit Sub
End Try
-------------------------------------------------------------------------
here is the connection strings.
Dim ExceCon As String = _
"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & _
ExcelPath & "; Extended Properties=Excel 8.0"

Try this for your connection string for Excel

"Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=" & filename & ";"

This article has been dead for over six months. Start a new discussion instead.