J
Jon Turlington
When in access the SQL Statement works as expected; in ADO it does not.
I have replaced the * with the % so I am sure that's not the problem.
Anyone have any idea?
<%
Dim objConn, objRS, sCity,CONNECTIONSTRING,ReponseString
CONNECTIONSTRING = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Documents and
Settings\jturlington\Desktop\Demographics\App_Data\DemoGraphics.mdb;User
Id=admin;Password=;"
'Capture the username that we need to lookup, making sure its prepared
for
'our forthcoming SQL query
sCity = Replace(Trim(Request.QueryString("city")),"'","")
'Fire up ADO - ask the database whether or not the user idexists
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open CONNECTIONSTRING
sSQL = "select ID,GeographicArea from Data where GeographicArea like
'%uni%'"
response.Write(sSQL & "<br />")
Set objRS = objConn.Execute(sSQL)
WHILE NOT objRS.EOF
ReponseString = objRS("ID") & "=" & objRS("GeographicArea") & ","
objRS.MoveNext
WEND
Response.Write(sCity & " ")
If Len(ResponseString) > 1 Then
Response.Write(Left(ResponseString, Len(ResponseString) - 1))
Else
Response.Write("No Records")
End If
'Clean up
objRS.Close
objConn.Close
Set objRS = Nothing
Set objConn = Nothing
%>
I have replaced the * with the % so I am sure that's not the problem.
Anyone have any idea?
<%
Dim objConn, objRS, sCity,CONNECTIONSTRING,ReponseString
CONNECTIONSTRING = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Documents and
Settings\jturlington\Desktop\Demographics\App_Data\DemoGraphics.mdb;User
Id=admin;Password=;"
'Capture the username that we need to lookup, making sure its prepared
for
'our forthcoming SQL query
sCity = Replace(Trim(Request.QueryString("city")),"'","")
'Fire up ADO - ask the database whether or not the user idexists
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open CONNECTIONSTRING
sSQL = "select ID,GeographicArea from Data where GeographicArea like
'%uni%'"
response.Write(sSQL & "<br />")
Set objRS = objConn.Execute(sSQL)
WHILE NOT objRS.EOF
ReponseString = objRS("ID") & "=" & objRS("GeographicArea") & ","
objRS.MoveNext
WEND
Response.Write(sCity & " ")
If Len(ResponseString) > 1 Then
Response.Write(Left(ResponseString, Len(ResponseString) - 1))
Else
Response.Write("No Records")
End If
'Clean up
objRS.Close
objConn.Close
Set objRS = Nothing
Set objConn = Nothing
%>