-
I have problem with the following code. The MANUFACTOR was selected from the Manufactor_model field in SQL table, but when I run this, the code CAN'T find the record. Do I need to add someting to the line sqltemp="select * from HWtable where Manufactor_model = '"& MANUFACTOR &"'", since the Manufactor_model field type is nvarchar?
Thanks....
<%
myDSN="DSN=INVENTORY;uid=xxx;pwd=xxx"
set conntemp=server.createobject("adodb.connection")
conntemp.open myDSN
MANUFACTOR=Request.QueryStrin("MANUFACTORY")
sqltemp="select * from HWtable where Manufactor_model = '"& MANUFACTOR &"'"
set rstemp = conntemp.execute(sqltemp)
PROCESSOR= rstemp("processor")
RAM_INSTALLED= rstemp("RAM_INSTALL")
RAM_MAX= rstemp("RAM_MAX")
VIDEO_CARD= rstemp("VIDEO_CARD")
VIDEO_MEM= rstemp("VIDEO_MEM")
RESOLUTION= rstemp("RESOLUTION")
rstemp.close
set rstemp=nothing
conntemp.close
set conntemp=nothing
%>
-
Try using Like operator instead of equal. Sometimes this makes a differnce.
-
What field in your DB is the INT type?
-
Didn't work with like. I wonder if the field manufactor_model being a nvarchar have to with it.
-
Are you getting any syntax errors or is it just returning no records found.
It appears as if you are not checking to see if MANUFACTOR has something in it. try putting in an if something like this:
if Request.QueryStrin("MANUFACTORY") = "" Then
MANUFACTOR="%"
else
MANUFACTOR=Request.QueryStrin("MANUFACTORY")
end if
This will check for empty strings and handle blank fields in the sql query. You will still have to use the like operator for this.
If you have handled the empty string else where then sorry this probably won't help.
hope this is helpful
Marita_l
-
You are missing the G at the end of QueryStrin, maybe that'll do it....but your code looks right unless you are not receiving the value of the manufacturer....try using response.write at various points to determine if your script is working correctly
-
There is a response with reponse.write, I have no problem if I used the field with INT type. Any other suggestions?
Thanks...