Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Type Mismatch

Status
Not open for further replies.

Dashsa

Programmer
Aug 7, 2006
110
US
Hello,
I am connecting to a database and trying to display data based on user input from a form .
I want a user to type a PO number into a form and then the code will return the data relevent to that PO Number.

The issue I am having is I am getting a data type mismatch error when I try to math the user input to the database PO Number. The DB PONumber is an Auto Number.
Code:
<%@ LANGUAGE="JScript"%>
<!-- #include file="adojavas.inc" -->
<HTML>
<HEAD>
<TITLE>View PO Numbers</TITLE>
</HEAD>
<%
var PONumber = Request.Form("POChoice")

var recordSet = Server.CreateObject("ADODB.RecordSet");
	recordSet.Open("select * from Data"+" WHERE PONumber ='" + PONumber + "'", "DSN=ccspo");
	Response.Write(PONumber)
%>

<body>
<img src="smallCCSLOGO.jpg" />

</script>
</body>
</html>
 
Try removing the single quotes.
Code:
recordSet.Open("select * from Data"+" WHERE PONumber ='" + PONumber + "'", "DSN=ccspo");
Code:
recordSet.Open("select * from Data"+" WHERE PONumber =" + PONumber, "DSN=ccspo");

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top