Hi guys, i'm trying to create a form where you can enter the name of the table you want to view and it will list everything in the table.. I'm taking the name typed into the table name on the first form and trying to insert it into an sql statement on the second form. it's not working here's what i have...
Dim strSQL
strSQL = "SELECT * FROM Table WHERE Table = '" & Request.Form("Table"
& "'"
Response.Write strSQL 'to check for errors
Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
objConn.Open "DSN=Employees2"
Dim objRS
Set objRS = Server.CreateObject("ADODB.Recordset"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
objRS.Open strSQL, objConn
Dim fCount, i
fCount = objRS.Fields.Count - 1
Response.Write "<table border=1><tr bgcolor='#EEEEEE'>"
for i=0 to fCount
Response.Write "<th>" & objRS(i).name & "</th>"
next
Response.Write "</tr>"
While Not objRS.EOF
Response.Write "<tr>"
for i=0 to fCount
Response.Write "<td> " & objRS(i).value & "</td>"
next
Response.Write "</tr>"
objRS.MoveNext
Wend
Response.Write "</table>"
objRS.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
The error i'm gettint is in the SQL statement the Employees2 entered from the first form is being inserted as 'Employees2' any way to fix this? also i'd like to be able to insert the DSN on the first form and have it dynamic as well... thanks in advance guys.
Dim strSQL
strSQL = "SELECT * FROM Table WHERE Table = '" & Request.Form("Table"
Response.Write strSQL 'to check for errors
Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection"
objConn.Open "DSN=Employees2"
Dim objRS
Set objRS = Server.CreateObject("ADODB.Recordset"
objRS.Open strSQL, objConn
Dim fCount, i
fCount = objRS.Fields.Count - 1
Response.Write "<table border=1><tr bgcolor='#EEEEEE'>"
for i=0 to fCount
Response.Write "<th>" & objRS(i).name & "</th>"
next
Response.Write "</tr>"
While Not objRS.EOF
Response.Write "<tr>"
for i=0 to fCount
Response.Write "<td> " & objRS(i).value & "</td>"
next
Response.Write "</tr>"
objRS.MoveNext
Wend
Response.Write "</table>"
objRS.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
The error i'm gettint is in the SQL statement the Employees2 entered from the first form is being inserted as 'Employees2' any way to fix this? also i'd like to be able to insert the DSN on the first form and have it dynamic as well... thanks in advance guys.