How to use ASP & SQL Server Connect to Database This is tutorial asp developers how to using asp connect to SQL Server database.
ShotDev Focus:
- ASP & SQL Server (Connect to Database)
Example
asp_sqlserver_connect.asp
<% Option Explicit %> <html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <% On Error Resume Next '*** Not Show ASP Error ***' Dim Conn Set Conn = Server.Createobject("ADODB.Connection") Conn.Open "Driver={SQL Server};Server=localhost;Database=mydatabase;UID=sa;PWD=;" If Err.Number <> 0 Then Response.write("(SQL Server) Database cannot connect Error = "&Err.Description&"<br>") Else Response.write("(SQL Server) Database connected.<br>") End If Conn.Close() Set Conn = Nothing %> </body> </html>
Create a asp file and save to path root-path/myasp/
Run
http://localhost/myasp/asp_sqlserver_connect.asp
Screenshot