Monday, February 21, 2011

Kates Playground, Wikipedia

ASP: Connecting to a Database Access

Here is the script to connect and view items in a Table:

\u0026lt;
% Set Conn = Server.CreateObject ("ADODB.Connection")
conn.Open "DRIVER = {Microsoft Access Driver (*. mdb)}; DBQ =" & Server.MapPath (".") & ". \\ nomedatabase.mdb"

sql = "SELECT * FROM Casting
Set rs = Server.CreateObject ("ADODB.Recordset") rs.Open
sql, conn, 3, 3

if Request.Form ("Name") \u0026lt;> "" then
rs.AddNew
rs.Fields ("Name") = Request.Form ("Name") end if
rs.update


rs.MoveFirst

do until rs .
EOF Response.Write (rs.Fields ("Name") & "\u0026lt;BR>)
rs.MoveNext


loop rs.Close

September
rs = Nothing Set Conn = Nothing conn.Close

%>

0 comments:

Post a Comment