Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS-SQL Connection

Status
Not open for further replies.

parames

MIS
Jun 26, 2000
71
MY
Hello list..

How to connect to a sql-server using odbc connectivity in asp.. My web pages(asp pages) are in different server..and my database is in sql server... normally we will do something like this..

set oConn = Server.CreateObject("ADODB.Connection")
oConn.open "PROVIDER=SQLOLEDB;DATA
SOURCE=sqlservername;UID=username;PWD=password;DATABASE=databasename"

But, i want to use odbc(dsn name) instead of using server ip to do the connection.. How to do it.. Please help..

thanks a lot..

parames.s
 
Simple...

<%
set ADOConn = Server.CreateObject(&quot;ADODB.Connection&quot;)
ADOConn.Open &quot;MyDSNname&quot;, &quot;MyUserName&quot;, &quot;MyPassword&quot;
%>

Hope this helps...
Gary
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top