Insert Excel data into sql table

S

Striker

I am trying to insert into a SQL table the results of some variables. Let's
say I have variables called; PHONE,LNAME,FNAME and I want to insert them
into a table called CONTACTS with Field names (FIRST, LAST, TELEPHONE)



What syntax can I use to insert the value from these variables into the
table? Also if I do not provide a SQL UID/Password, will it attempt to use
the network information form the persom logged in? Some of the code I have
come up with is below. Just seem to be missing the insert query part of it.



~~~~~~~~Code to open connection~~~~~~~~~~~~~~~~~~
'Dim MyConnection As ADODB.Connection

'Dim MySQL As String

'Set MyConnection = New ADODB.Connection

'MyConnection.Open "driver=SQL
Server;server=sql01;DATABASE=Sta01l;UID=;PWD=;"



INSERT QUERY STATEMENT HERE



'MyConnection.Execute MySQL

'MyConnection.Close

'Set MyConnection = Nothing

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top