Oy, I've been over this too much & need some different eyes looking at it.
It's a simple insert into statement
that keeps coming back with the "hey you dummy" ODBC Drivers error '80040e10'.
Incase the error number means nothing: "[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 11."
(asp, not php :))
<%
set EntryId = request.form("EntryID")
set DbName = request.form("DbName")
set IName = request.form("IName")
set VenName = request.form("VenName")
set ConsPrice = request.form("ConsPrice")
set PriceBasedOn = request.form("PriceBasedOn")
set SimulUsers = request.form("SimulUsers")
set Access = request.form("Access")
set ApCost = request.form("ApCost")
set SubsYear = request.form("SubsYear")
set Comments = request.form("Comments")
set conn = server.createobject("ADODB.connection")
conn.open "TN-Db"
%>
Good through here!
<!--
Frig! Am getting stuck with Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 11.
/library/dobbsa/tennshar/DbSub!inserted.asp, line 42
There are 11 fields in the script (& 11 in the table) with 11 values listed.
-->
<%
InsertSQL = "INSERT INTO EnteredSubscrsTbl (EntryID, DbName, InstitutionName, VendorName, ConsortialPrice, PriceBasedOn, SimulUsers, Access, ApproxCost, SubsYear, Comments) VALUES (EntryID, DbName, IName, VenName, ConsortialPrice, PriceBasedOn, SimulUsers, Access, ApCost, SubsYear, Comments)"
Conn.execute(InsertSQL)
Is there sometihng obvious I'm missing here?
-Spaz68
:confused:
Stopper31
04-02-2004, 08:25 PM
Your ConsortialPrice variable names don't match... check those and see if that's doing it.
buntine
04-02-2004, 10:23 PM
What are you trying to do at the top of your script? You only need the SET keyword when you are creating objects.
If you use the SET keyword with ordinary variables, all sorts of weird stuff can happen because ASP thinks they are objects.
Also, 'ConsortialPrice' should be 'consPrice'
Regards,
Andrew Buntine.
Spaz68
04-08-2004, 06:20 PM
To Stopper31: whew, thanks totally missed that (even several days later, today) fixed it. :rolleyes:
To buntine: I was setting variables that should populate from the form calling this .asp page. I pulled the "SET"s out of the page & it doesn't seem to matter. :(
{edit: Okay from: http://www.vyomworld.com/source/show.asp?ScriptID=46 suggested the error code might be related to incompatible data types (which would be correct as "EntryID" is a string & the field type is autonumber and "ApproxCost" is supposed to be a number) that post also sugested response.writing the SQL -- good idea, clarifies the problem)
How do I get the Values of the variables named above to transfer into the SQL statement? /edit}
-Spaz68
Is it considered bad form to post the url?
Stopper31
04-09-2004, 01:58 PM
If EntryID is an autonumber, you should completely ignore it from your insert statement and let the database handle it... you should never supply a value, regardless of its type if it's an autonumber.
As for the variables, you have to seperate them like this:
sSQL = "INSERT into tblTest (a,b,c) values (" & varA & "," & varB & "," & varB & ")"
Stopper31
04-09-2004, 02:01 PM
So, to make your script work, change the sql line to:
Ugh, but then I get this that I've never seen: COUNT field?!
Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
[Microsoft][ODBC Microsoft Access Driver]COUNT field incorrect
/library/dobbsa/tennshar/DbSub!inserted.asp, line 62 (line 62 is the Conn.execute(InsertSQL) to run the SQL statement)
ODBC Programmer's Reference:
SQLExecDirect Function
Conformance
Version Introduced: ODBC 1.0
Standards Compliance: ISO 92
Summary
SQLExecDirect executes a preparable statement, using the current values of the parameter marker variables if any parameters exist in the statement. SQLExecDirect is the fastest way to submit an SQL statement for one-time execution.
But I'm not running agaist a SQL server, it's an Access db and I didn't make an SQLExecDirect statement?
SQL server state 07002
COUNT field incorrect:
The number of parameters specified in SQLBindParameter was less than the number of parameters in the SQL statement contained in *StatementText.
SQLBindParameter was called with ParameterValuePtr set to a null pointer, StrLen_or_IndPtr not set to SQL_NULL_DATA or SQL_DATA_AT_EXEC, and InputOutputType not set to SQL_PARAM_OUTPUT, so that the number of parameters specified in SQLBindParameter was greater than the number of parameters in the SQL statement contained in *StatementText. Nor does this make sense to me (at all).
Is this sayinig I have to specify the field type for each field, as well? This is what M$ says about SQLBindParameter:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcsqlexecdirect.asp
So much for thinking this would be an easy one :o
Stopper31
04-10-2004, 02:19 AM
Not quite sure on that one... but it appears you're trying to pass string values into the SQL statement. If that is the case, they have to be enclosed within single quotes.
IE: INSERT INTO tblTemp (field1, field2) VALUES ('test value', 'another test value')
Fix that up and see if that helps anything!
Spaz68
04-13-2004, 02:24 PM
Sheesh!
Punctuation is/was never my strong suit. Here's what I ended up doing to get it to (finally) work properly: