Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

dsnless connection to sql

Posted on 2005-05-02
9
Medium Priority
?
341 Views
Last Modified: 2010-03-19
Hi

I have used a solution for an online events calendar written by someone else which uses a an access database with a dsnless connection.  

I have migrated the access database to sql using DTS.  I wondered if someone can point me in the right direction in terms of the syntax i have to use to point to the sql database.  Please see below the original syntax used to point to the access database.

 <%
dim dsn
dim Conn
dsn="DBQ=" & Server.Mappath("o12cal.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};"
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open dsn
%>


My new sql database is also called o12cal

Thanks in advance

grant
0
Comment
Question by:grantballantyne
6 Comments
 
LVL 13

Accepted Solution

by:
ispaleny earned 1000 total points
ID: 13911920
Conn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=YourDatabase;Data Source=YourServer"
 
0
 

Author Comment

by:grantballantyne
ID: 13911986
Hi thanks for the advise, could you advise of the full syntax, im anabsolute beginner in dsnless connections.

Thanks

Grant
0
 
LVL 13

Expert Comment

by:ispaleny
ID: 13912077
It has nothing to with DSN, it is OLEDB connection string. Create an empty test.udl file, right click on it, select properties, provider and so on. Then open it in notepad and you have your connection string. I think it is a good point to start on, most syntax differs by provider.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 23

Expert Comment

by:Saqib Khan
ID: 13912107
Set con = Server.CreateObject("Adodb.Connection")
con.open "driver={SQL Server};server=Serve_IP;uid=sk;pwd=1111;database=Database_name"

0
 
LVL 11

Expert Comment

by:Jokra_the_Barbarian
ID: 13912828
This will give you more info: http://www.connectionstrings.com/
0
 
LVL 13

Expert Comment

by:ispaleny
ID: 14107238
grantballantyne got what he wanted and forgot on us all ;)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question