 |
| Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

February 28th, 2004, 11:22 AM
|
|
Authorized User
|
|
Join Date: Feb 2004
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
SELECT STATEMENT error
Me, AGAIN (hangs head down in shame)
Below is code I am using to select all of the entries where Ticket_ID field is equal to OPEN. This is how I got it done but it comes back with an error.
Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
/Smc/ticket/view_tickets.asp, line 18
<%
ConnString = "DSN=ticketbackup;"
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open ConnString,,,adOpenForwardOnly
Set rs = SERVER.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM ticket where type LIKE '" & "%OPEN%" & "' ORDER BY Ticket_ID"
rs.Open strSQL,conn, adOpenStatic
%>
Once again it is probably pretty simple but me being new to this game...well u know what I am saying.
Thank you in advance
|
|

February 28th, 2004, 11:39 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
Take a look at this FAQ: http://www.adopenstatic.com/faq/80040e10.asp
It deals with 80040e10 errors.
You may want to rename the Type column, as Type is (or at least sounds like) a reserved keyword for Access.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

February 28th, 2004, 01:30 PM
|
|
Authorized User
|
|
Join Date: Feb 2004
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
IMAR YOU ROCK :)
I fixed the previous error, now working on this:
<%
ConnString = "DSN=ticketbackup"
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open ConnString,,,adOpenForwardOnly
Set rs = SERVER.CreateObject("ADODB.Recordset")
strSQL = "SELECT Ticket_ID FROM ticket WHERE Ticket_state = 'CLOSE' GROUP BY Ticket_ID ORDER BY Ticket_ID "
rs.Open strSQL,conn, adOpenStatic
%>
UP to heere all is well, after that I simply want to extract the recordset for Ticket_ID selected in the above query. Below is the code including form. It comes back to me with an error:
<form name="openedticket">
<p><select name="open" size="1">
<option value="NULL" selected>TICKET ID</option>
<% Do While Not rs.EOF
Response.Write ("<OPTION value='"& rs("Ticket_ID") & "'>" & rs("Ticket_ID"))
rs.MoveNext
Loop
rs.Close
Set rs=Nothing
%> </select><input type="submit" value="View by Ticket ID"> </p>
</form>
<%
Set rs = SERVER.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM ticket "
strST=Request.QueryString("open")
strSQL = "SELECT * FROM ticket WHERE Ticket_ID = '" & strST & "'"
response.write(strSQL)
' Open Recordset Object
rs.Open strSQL,conn,adOpenStatic
%>
ELECT * FROM ticket WHERE Ticket_ID = ''
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
|
|

February 28th, 2004, 01:58 PM
|
|
Authorized User
|
|
Join Date: Feb 2004
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I think that I might be getting that error due to the fact that i am performing that operation on Ticket_ID, whihc is set to Autonumber (recordID)
any thought???
|
|

February 28th, 2004, 03:15 PM
|
|
Authorized User
|
|
Join Date: Feb 2004
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I confirmed it, I was getting the error because of the Ticket_ID was is set to Autonumber.
|
|

February 28th, 2004, 04:05 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
If Ticket_ID is a number (any number, not just AutoNumber), you can't use an apostrophe to enclose the value:
strSQL = "SELECT * FROM ticket WHERE Ticket_ID = " & strST
You may also want to check out this article: http://www.adopenstatic.com/faq/selectstarisbad.asp and find out why SELECT * is bad...
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|
 |