Is there a way to display the results of a query on a asp page. I've made a query and would like the results to be displayed in a asp page. Is that possible?
Sure!
Since I dont know how familiar you are to ASP we´ll take it step by step:
1. Run your query like this:
-----------------------------------------------
SQL = "Select firstname,lastname from People"
RS.Open SQL,Conn
2. Loop all the records until EOF is true (EOF = End Of File)
-----------------------------------------------
DO WHILE NOT RS.EOF
[ code to execute, eg. Response.Write(RS("firstname") ]
RS.MoveNext
Loop
3. Close RS
The above example works if you have a declared recordset called RS and a databasen connection declared as Conn.
If you have that the code will print all the first names in the table People (my example that is =) )
Whell, I have a qry in access from wich I want the results displayed in a table. I've got a working code, but that is for ASP.net, and the server on wich it must run doesn.t support asp.net, And i'm unsuccesfull of converting the code to ASP. The asp.net code is:
Sub Page_Load(Src As Object, E As EventArgs)
Dim strConn as string ="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & server.mappath("\Database\Storingsformulier.mdb" & ";"
Dim strSQL as string ="select * from qry_test"
Dim Conn as New OLEDBConnection(strConn)
Dim Cmd as New OLEDBCommand(strSQL,Conn)
Conn.Open()
myDataGrid.DataSource = Cmd.ExecuteReader(system.data.CommandBehavior.CloseConnection)
myDataGrid.DataBind()
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.