954,566 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

QUICK! Access SQL using ASP and javascript

I am trying to access a SQL database and run a query. I am brand new with ASP and simply need the syntax to login and the for SQL queries in ASP. Any help would be appreciated, Thanks!

Andrew

amathias
Newbie Poster
1 post since May 2006
Reputation Points: 10
Solved Threads: 0
 

are you looking for something like this?

Set dbConn = Server.CreateObject("ADODB.Connection")
dbConn.ConnectionTimeout = 60 
dbConn.CommandTimeout = 300
dbConn.Open "DSN=DSNNAME;DATABASE=DATABASENAME","USERNAME","PASSWORD"

Set rsCustomers = Server.CreateObject("ADODB.RecordSet")
rsCustomers.ActiveConnection = dbConn


strSQL = "Select * From Customer where customerid = 1"
rsCustomers.Open strSQL,,1,3
If NOT(rsCustomers.EOF) Then
  customerName = rsCustomers("CustomerName")
  password = rsCustomers("CustomerPassword")
End If


rsCustomers.Close 
Set rsCustomers = NOTHING
dbConn.Close  
Set dbConn  = NOTHING
campkev
Posting Pro in Training
484 posts since Jul 2005
Reputation Points: 14
Solved Threads: 19
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You