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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connecting sql server database thru asp

Status
Not open for further replies.

shahina

Programmer
Aug 19, 2003
47
IN
Hi all..

i just started learning asp and i am not able to establish the connection to my db. db is in sql server..am writing the asp code like this
set conn = Server.CreateObject("ADODB.Connection")
conn.ConnectionString="Provider=MSDASQL.1;" "Data Source=dbname"
conn.Open

when previewed, the following error occured..
Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/asptest/sqltest.asp, line 9, column 44
conn.ConnectionString="Provider=MSDASQL.1;" "Data Source=dbname"

Please help me..

Thanx in advance..

shahina.
 
try this:
Code:
strConn = "DRIVER={SQL Server};SERVER=[b]myServerName[/b];DATABASE=[b]myDatabaseName[/b];UID=[b]myUserName[/b];pwd=[b]myPassword[/b];"
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open(strConn)

Tony
________________________________________________________________________________
 
Thank u FesterSXS..

now i am getting this error:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E4D)
[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'Servername\IUSR_Servername'.
/asptest/sqltest.asp, line 13


 
has the database actually got any protection on it? If not then you can leave the UID and pwd bits blank in the connection string.


Tony
________________________________________________________________________________
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top