7 replies
by shawn.tooley
by jcard
by shanghai sam
Assumptions:
1. NT 4 Platform
2. IIS Web Server
First things first, you should decide if your going to run a "dsn-less" connection or a "dsn" connection. I normally use dsn connections so I don?t have to deal with absolute paths to the access database. Some may argue however that dsn-less connections are quicker, and they may be, so if db size/performance is an issue, you may look into them.
Next, your gonna want to install the MDAC 2.5 updates available from Microsoft. If your running this off of a NT 4 box then you?ll want the newest Jet drivers as well (they include the update access driver for your dsn. The filename is ?jet40sp5_9xnt.exe?.
For a DSN connection, goto your ODBC Data Source Administrator (control panelfor NT4, Admin Tools for Win 2000) and create a system dsn pointing to your access database.
Once this is all done, you should have no problem, assuming you give permissions to your IIS Internet user to read the actual database file.
You can then use something like this at the top of your active server page to read the database.
<%
Set Apples = Server.CreateObject("ADODB.Connection")
ConnStr = "DRIVER={Microsoft Access Driver (*.mdb)}; "
ConnStr = ConnStr & "DBQ=" & Server.MapPath("database_name.mdb")
Apples.Open(ConnStr)
SQL = "SELECT * FROM table_name WHERE field_name = " & 1 & " "
Set rs = Apples.Execute(SQL)
while not rs.eof
var1 = rs("field_name1")
var2 = rs("field_name2")
rs.MoveNext
Wend
rs.Close
Apples.Close
set Apples = Nothing
%>
To query a field name by a number use this:
SQL = "SELECT * FROM table_name WHERE field_name = " & 1 & " "
To query a field name by a string use this
Dim Var3
Var3 = ?Some Text?
SQL = "SELECT * FROM table_name WHERE field_name = "? & var3 & "? "
Then, in the html, reference the variables like this:
<%=var1%>
<%=var2%>
by ed mcandrew
Tiz not transient...Tiz Me..!
Assumptions:
1. NT 4 Platform
2. IIS Web Server
First things first, you should decide if your going to run a "dsn-less" connection or a "dsn" connection. I normally use dsn connections so I don?t have to deal with absolute paths to the access database. Some may argue however that dsn-less connections are quicker, and they may be, so if db size/performance is an issue, you may look into them.
Next, your gonna want to install the MDAC 2.5 updates available from Microsoft. If your running this off of a NT 4 box then you?ll want the newest Jet drivers as well (they include the update access driver for your dsn. The filename is ?jet40sp5_9xnt.exe?.
For a DSN connection, goto your ODBC Data Source Administrator (control panel for NT4, Admin Tools for Win 2000) and create a system dsn pointing to your access database.
Once this is all done, you should have no problem, assuming you give permissions to your IIS Internet user to read the actual database file.
You can then use something like this at the top of your active server page to read the database.
<%
Set Apples = Server.CreateObject("ADODB.Connection")
ConnStr = "DRIVER={Microsoft Access Driver (*.mdb)}; "
ConnStr = ConnStr & "DBQ=" & Server.MapPath("database_name.mdb")
Apples.Open(ConnStr)
SQL = "SELECT * FROM table_name WHERE field_name = " & 1 & " "
Set rs = Apples.Execute(SQL)
while not rs.eof
var1 = rs("field_name1")
var2 = rs("field_name2")
rs.MoveNext
Wend
rs.Close
Apples.Close
set Apples = Nothing
%>
To query a field name by a number use this:
SQL = "SELECT * FROM table_name WHERE field_name = " & 1 & " "
To query a field name by a string use this
Dim Var3
Var3 = ?Some Text?
SQL = "SELECT * FROM table_name WHERE field_name = "? & var3 & "? "
Then, in the html, reference the variables like this:
<%=var1%>
<%=var2%>
by ed mcandrew
Sorry about answer 2, it took me so long to type that out that techrepublic logged me out...! The site then posted the answer as being from: transient.
Ed
by jcard
by jcard
This discussion is closed to new replies.
Trending Windows Forum posts
Sort by Trending