web 2.0

How to use ASP & SQL Server Connect to Database

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

ASP & SQL Server
.
.
.
Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 1.00 out of 10)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.