I'm wanting to use ADODB connection to upload a table into the sql database.
I need some help with the code. I know I need to
Create Connection
Open Connection to sql server.
Upload data from excel file on my pc.
Close Connection
I've found some code that may be what I need. I just don't understand it all.
thanks
PHP Code:
Dim con As Object
Set con = CreateObject("ADODB.Connection")
con.Open _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & ActiveWorkbook.Path & "\" & ActiveWorkbook.Name & ";" & _
"Extended Properties='Excel 8.0;HDR=YES;IMEX=1'"
con.Execute _
"INSERT INTO [ODBC;Driver={SQL Server};" & _
"SERVER=d1cply;DATABASE=d1cply;" & _
"UID=******;Pwd=*******;].MeasurementResults (Table_Column_Names)" & _
" SELECT Spreadsheet_Column_Names FROM [SQL_Dump$];"
con.Close
I've used VBA before, but not to connect to a sql server.
I'll be getting a sql server up soon, too.
TIA