Changing data access from MSAccess2000 to SQL Server

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am currently writing a program in Excel that will take data off of a SQL
server and dump it into an excel spreadsheet so that i can crunch numbers and
display the information. I used an access database with dummy information to
work on crunching the numbers because the serverwas not set up yet, but now i
want to grab the data off of the database we set up on the server instead of
the access file. i used a JET object to grab the data from the access file,
but i am having quite a hard time getting the data off of the server. this
is the code i used for the Access:

Set myConn = New ADODB.Connection
Set myRec = New ADODB.Recordset
myConn.Provider = "Microsoft.jet.oledb.4.0"
myConn.Open "\\yodisk2\shryork\tober\glassing1.mdb"

This is the code I am attempting to use for the SQL:

myConn.Provider = "SQLOLEDB.1"
myConn.ConnectionString= "DATABASE=glassPLC1;SERVER=yosql1;"

I am not sure why this is not working. Any advice would be greatly
appreciated. Thank you.
 
Jason said:
I am currently writing a program in Excel that will take data off of a SQL
server and dump it into an excel spreadsheet so that i can crunch numbers and
display the information. I used an access database with dummy information to
work on crunching the numbers because the serverwas not set up yet, but now i
want to grab the data off of the database we set up on the server instead of
the access file. i used a JET object to grab the data from the access file,
but i am having quite a hard time getting the data off of the server. this
is the code i used for the Access:

Set myConn = New ADODB.Connection
Set myRec = New ADODB.Recordset
myConn.Provider = "Microsoft.jet.oledb.4.0"
myConn.Open "\\yodisk2\shryork\tober\glassing1.mdb"

This is the code I am attempting to use for the SQL:

myConn.Provider = "SQLOLEDB.1"
myConn.ConnectionString= "DATABASE=glassPLC1;SERVER=yosql1;"

I am not sure why this is not working. Any advice would be greatly
appreciated. Thank you.
 
Jason said:
This is the code I am attempting to use for the SQL:

myConn.Provider = "SQLOLEDB.1"
myConn.ConnectionString= "DATABASE=glassPLC1;SERVER=yosql1;"

Try changing DATABASE to INITIAL CATALOG.

Jamie.

--
 

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

Back
Top