|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
connect asp to SQL
hi guys, i wanna ask your guys expertise. Is about SQL Server.
Now i am currently coding asp in my local computer using IIS where my project need to retrieve a record from SQL database, i don't know how to connect asp to SQL and how to set up the DSN. I have see some of the code in asp where they write like: <% DSN=intranet dblogin="sa" dbpswd="" %> Can u guys solve it, thanks.... ![]() |
|
#2
|
|||
|
|||
|
Search this site for tutorials, and sites like www.w3schools.com
__________________
====== Doug G ====== I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain |
|
#3
|
||||
|
||||
|
Example of how to connect to and retrieve data from SQL Server.
Code:
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=sqloledb;Data Source=ServerName;Initial Catalog=DatebaseName;User Id=Username;Password=Password;"
strSql = "SELECT FieldName FROM TableName"
Set rs = Conn.Execute(strSql)
If rs.eof Then
Response.write("No records returned")
End If
do until rs.eof
Response.write(rs("FieldName") & "<br>")
rs.movenext
loop
Conn.Close
Set Conn = Nothing
|
|
#4
|
|||
|
|||
|
what is the username and password i have to key in? Do i need to set up the DSN configuration in ODBC if so can u let me know
|
|
#5
|
||||
|
||||
|
My example is a DSN-less connection.
For more information check out the link below. ConnectionStrings |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft SQL Server > connect asp to SQL |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|