I am connecting an ASP page to an Access table. The table in Access has a field called orderNo which is of type "Number". Now...what I want to do is design an SQL statement in the ASP page which picks up all records from the table where username and orderNo match the values that are being stored into the variables inside the ASP page.
Let me illustrate.
someFile.asp
-----------------
Expand|Select|Wrap|Line Numbers
- <%
- Dim orderNo, username
- orderNo = Request.QueryString("orderNo")
- username = Request.QueryString("username")
- Dim conn,SQLQuery, data_source
- data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source = "&_
- Server.MapPath("orders.mdb")
- SQLQuery = "select description,qty,price from purchase where Username = '"&UserName&"' AND orderNo = '"&orderNo&"'"
- Set conn = Server.CreateObject("ADODB.Connection")
- conn.open(data_source)
- set rs = conn.Execute(SQLQuery)
- %>
..............
Microsoft JET Database Engine error '80040e07'
Data type mismatch in criteria expression.
..............
When I replace the orderNo with another text based field from the table it works just fine. :(
Please help.
Sk