If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > I need some help with ADODB

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-10-07, 13:49
Jay59 Jay59 is offline
Registered User
 
Join Date: Sep 2006
Posts: 162
I need some help with ADODB

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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On