Need help in ASP with MSsql

H

hussein_bahadi

Guest
Can any one help me with the code of

connecting to MSSql database ... but in ASP not ASP.NET ?!

Please .......

I realy need the code of connecting for my first project ..

with my best wishes ,,, :))
 
<%
'This is the connection object
Dim objADODbCon
Set objADODbCon = Server.CreateObject("ADODB.Connection")

'Logon details
Const strSQLServer = "adress/ip to the sql server"
Const strSQLServerDataBase = "name of the database"
Const strSQLServerUser = "name of a user with read and write permissions to the database"
Const strSQLServerPassword = "password to the selected user"

'Open the connection
objADODbCon.Open "Provider=SQLOLEDB;Server=" & strSQLServer & ";User ID=" & strSQLServerUser & ";Password=" & strSQLServerPassword & ";Database=" & strSQLServerDataBase & ";"
%>


also remember to close the connection on the end of the pages:
<%
'Reset the recordset object
Set <recordsetname> = Nothing
'Close the connection
objADODbCon.Close
'Reset connection object
Set objADODbCon = Nothing
%>
 
DirtBag said:
<%
'This is the connection object
Dim objADODbCon
Set objADODbCon = Server.CreateObject("ADODB.Connection")

'Logon details
Const strSQLServer = "adress/ip to the sql server"
Const strSQLServerDataBase = "name of the database"
Const strSQLServerUser = "name of a user with read and write permissions to the database"
Const strSQLServerPassword = "password to the selected user"

'Open the connection
objADODbCon.Open "Provider=SQLOLEDB;Server=" & strSQLServer & ";User ID=" & strSQLServerUser & ";Password=" & strSQLServerPassword & ";Database=" & strSQLServerDataBase & ";"
%>


also remember to close the connection on the end of the pages:
<%
'Reset the recordset object
Set <recordsetname> = Nothing
'Close the connection
objADODbCon.Close
'Reset connection object
Set objADODbCon = Nothing
%>
Might want to throw in the network library and the initial catalog info as well.

"Provider=SQLOLEDB;Persist Security Info=False;User ID=user_name;PWD=*****;Initial Catalog=user_databasename;Data Source=mssql1.jodoshared.com;Network Library=DBMSSOCN"

Tonto
 
Back
Top