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

ASP Connection to SQL Server

Status
Not open for further replies.

yyl

IS-IT--Management
Mar 19, 2003
7
HK
Any guys can help me, how to connection to SQL Server with ASP code and read data?
 
Google Is Our Friend [wink]

___________________________________________________________________

The answer to your ??'s may be closer then you think.
Check out Tek-Tips knowledge bank by clicking the FAQ link at the top of the page faq333-3811
 
For SQL Server:
The below is the connection string

Code:
oConn.Open "Driver={SQL Server};" & _ 
           "Server=MyServerName;" & _
           "Database=myDatabaseName;" & _
           "Uid=myUsername;" & _
           "Pwd=myPassword"

-VJ


 
I recommend an OLEDB connection.

cn.open "Provider=SQLOLEDB.1;User Id=XXXX;Password=;Data Source=myDBname;Initial Catalog=myTableName"

onpnt is right though - a new thread is not needed to get this very basic information. Either use google or do a keyword search in the forum.

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

zen.gif
 
I use the below code for connection string to SQL server, but can't connect and have error message display on the SQL error log.

<%
Dim conn,StrConn
set conn = Server.CreateObject("ADODB.Connection")
StrConn = "driver={SQL server};server=servername;database=pubs;uid='myusername';pwd='nopassword'"
conn.Open(StrConn)
.
.
conn.close
%>

Error message:
Login failed for user ''myusername''. Reason: Not associated with a trusted SQL Server connection.

How to solve the problem?
 
did you set permission on the catolog (database)

___________________________________________________________________

The answer to your ??'s may be closer then you think. faq333-3811
Join the Northern Illinois/Southern Wisconsin members in Forum1064
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top