SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Struggling to change an Access Connection string to MS SQL Server


Struggling to change an Access Connection string to MS SQL Server

Author
Message
Hans K
Hans K
Forum Newbie
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: General Forum Members
Points: 7 Visits: 17
Hi there,
I have an evaluation application that I am trying to configer to use SQL server instead of the built in Access database.

I have created and set up all the tables and fields on the SQL server, but cannot get the database functionality to connect and work correctly.

The string this is used for the Access DB is as follows:

Function OpenDB
Dim Conn
' Connect the database
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Provider = "Microsoft.Jet.OLEDB.4.0"
Conn.Open Server.MapPath("dbname.mdb")
Set OpenDB = Conn
End Function


For SQL server, the string is usually very different, like:

Conn = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=username;pwd=password;Initial Catalog=MyDatabse;Data Source=ServerName"


How and where can I make changes to this string, so that I can get things to work with SQL Server, rather than with Access?

Many thanks

Hans
arooney
arooney
Grasshopper
Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)

Group: General Forum Members
Points: 14 Visits: 22
This sounds like an application level issue vs. a database issue.;-)
lshanahan
lshanahan
SSChasing Mays
SSChasing Mays (642 reputation)SSChasing Mays (642 reputation)SSChasing Mays (642 reputation)SSChasing Mays (642 reputation)SSChasing Mays (642 reputation)SSChasing Mays (642 reputation)SSChasing Mays (642 reputation)SSChasing Mays (642 reputation)

Group: General Forum Members
Points: 642 Visits: 436
The exact string you use depends upon how you connect to the SQL server back end (the Provider) and how the security/authentication is set up on SQL server. Below is a helpful resource on connection strings with examples (it's geared toward SQL Server 2005, but a lot of it applies to later versions) and other information:

http://www.connectionstrings.com/sql-server-2005

____________
Just my $0.02 from over here in the cheap seats of the peanut gallery - please adjust for inflation and/or your local currency.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search