ASP refers to Active Server Pages.
ASP is a server side scripting technology.
ASP file has .asp extension.
Database Connectivity in ASP:
ASP and SQL sever:
<%@ Language=VBScript %>
<%
Dim cn, str, rs
set cn = Server.CreateObject("ADODB.Connection")
conn.ConnectionString = "driver={SQL Server};" & _
"server=SQLservername;" & _
"uid=admin;" & _
"pwd=nopass;" & _
"database=payroll;"
cn.Open
Response.Write "Got Connection"
set rs = Server.CreateObject("ADODB.Recordset")
str = "Select * from emp"
rs.open strsql,cn
do while not rs.eof
Response.Write rs(1)
Response.Write rs(2) & "<br/>"
loop
rs.close
%>
ASP and Ms-access:
<%@ Language=VBScript %>
<% dim cn , rs , str
set cn = Server.createobject("adodb.connection")
p= Server.mappath("payroll.mdb")
cn.open "provider=microsoft.jet.oledb.4.0;data source=" & p
set rs = Server.createobject("adodb.recordset")
str = "select * from emp"
rs.open strsql,cn
do while not rs.eof
Response.Write rs(1)
Response.Write rs(2) & "<br/>"
loop
rs.close
%>
ASP and Oracle:
<%
dim cn
Set cn = Server.CreateObject("ADODB.Connection")
cn.Open "dsn=dsnfororacle;"
'We have to create a DSN (Data Source Name) for Oracle.
'Rest is same as above
%>
No comments:
Post a Comment
Thanks for visiting my Blog!