Click to See Complete Forum and Search --> : ASP database problem
s_allamneni
02-15-2003, 11:49 PM
i have a database problem in asp? i'm trying to inset the customerinfo into my database table. I'm getting the following error:
Microsoft JET Database Engine error '80040e10'
No value given for one or more required parameters.
The above error is at the line :
connection.Execute(strSQL)
where
strSQL = "INSERT INTO customers (CustomerID,companyname)" _
& "VALUES (1,company_name)" _
& ";"
thanks for ur help.
Ribeyed
02-16-2003, 07:20 AM
hi,
i am not 100% sure about this one but i think is because it it take 1 as being a variable and not an integer. To find out what is causing the error replace your
set RS = database.execute(sql) with response.write(sql)
this will write out your complete sql string to the screen.
As i said i think you will find that where you have 1, on the output it will be blank. In your code it thinks 1 is a variable and you haven't set a value to the variable 1 then you will get an error saying no value for parameter. If in your code you have
thenumber = 1
then have
strSQL = "INSERT INTO customers (CustomerID,companyname)" _
& "VALUES ("&thenumber&", '"&company_name&"')" _
& ";"
this would work.
edited: sorry error with my code pointed out by Dave Clark bellow.
Hope this helps
s_allamneni
02-16-2003, 11:18 PM
Here is the part of the code
<%
Dim email
Dim name
Dim company_name
email = Request("email")
name = Request("name")
company_name = Request("company_name")
%>
<%= email %>
<BR>
<%= name %>
<BR>
<%= company_name %>
<BR>
<%
Dim strURL ' The URL of this page so the form will work
' no matter what this file is named.
Dim cnnSearch ' ADO connection
Dim rstSearch ' ADO recordset
Dim strDBPath ' path to our Access database (*.mdb) file
Dim strSQL ' The SQL Query we build on the fly
Dim strSearch ' The text being looked for
Dim strNumber ' The charm number being looked for
Dim prodName
' Retreive the URL of this page from Server Variables
strURL = Request.ServerVariables("URL")
' Retreive the term being searched for. I'm doing it on
' the QS since that allows people to bookmark results.
' You could just as easily have used the form collection.
' Since I'm doing this all in one page I need to see if anyone
' has searched for something. If they have we hit the DB.
' O/W I just show the search form and quit.
%>
<%
' MapPath of virtual database file path to a physical path.
' If you want you could hard code a physical path here.
strDBPath = Server.MapPath("customer.mdb")
' Create an ADO Connection to connect to the sample database.
' We're using OLE DB but you could just as easily use ODBC or a DSN.
Set cnnSearch = Server.CreateObject("ADODB.Connection")
' This line is for the Access sample database:
cnnSearch.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & ";"
' We're actually using SQL Server so we use this line instead:
'cnnSearch.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & ";" _
' & "Initial Catalog=samples;User Id=;Password=;" _
' & "Connect Timeout=15;Network Library=dbmssocn;"
' Build our query based on the input.
thenumber = 1
strSQL = "INSERT INTO customers (CustomerID,companyname)" _
& " VALUES ("&thenumber&","&company_name&")" _
& ";"
' Execute our query using the connection object. It automatically
' creates and returns a recordset which we store in our variable.
response.write strSQL
'response.end
Set rstSearch = cnnSearch.Execute(strSQL)
' cnnSearch.Execute(strSQL)
%>
I'm still getting the following error:
INSERT INTO customers (CustomerID,companyname) VALUES (1,abc);
Microsoft JET Database Engine error '80040e10'
No value given for one or more required parameters.
/login/registerhandler.asp, line 183 <----- this line is the line where we execute the sql i.e cSet rstSearch = cnnSearch.execute(strSQL)
thanks for ur help
Ribeyed
02-17-2003, 05:03 AM
hi,
try to test the output of the sql query. Remove any working on the recordset after this line:
response.write strSQL
even the line that creates the recordset. You should now be able to see the strSQL on your screen.
This is not right either:
email = Request("email")
name = Request("name")
company_name = Request("company_name")
this should be one of the following
email = Request.form("email")
pname = Request.form("name")
company_name = Request.form("company_name")
or
email = Request.querystring("email")
name = Request.querysting("name")
company_name = Request.querysting("company_name").
Again try removing the working on the recordset and instead just write these values out to screen to make sure the variables have values.
response.write email
response.write pname
response.write company_name
You will find out what value is missing if you just write out the sql query string to screen.
response.write strSQL
but rememebr to remove all the recordset working our you will get a lot of errors.
s_allamneni
02-20-2003, 12:13 PM
I tried putting single quotes arround the "companyname" then the SQL string is not printing correctly. I have created a database with just one column "companyname" and try to insert a record using the following code, but it didn't work
strSQL = "INSERT INTO Customers (CompanyName) VALUES ("'&company_name&'");"
then i'm getting the follwoing error:
abc
INSERT INTO Customers (CompanyName) VALUES (
Microsoft JET Database Engine error '80040e14'
Syntax error in INSERT INTO statement.
/login/registerhandler.asp, line 184
If i don't put the single quote arround company name, sql string is printing okay, but i'm getting the same error:
abc
INSERT INTO Customers (companyname) VALUES (abc);
Microsoft JET Database Engine error '80040e10'
No value given for one or more required parameters.
/login/registerhandler.asp, line 184
Thank you for ur help
Ribeyed
02-20-2003, 12:34 PM
hi,
("'&company_name&'");" will not work.
('"&company_name&"');"
swap the ' with "
s_allamneni
02-20-2003, 12:54 PM
Thank You!!
It did work after i swap the quotes. I'm kinda lost touch with SQL programming, i should have known that, anyways it's always good to talk to someone.
Thanks again.
intergraphix
08-10-2006, 10:17 AM
I need a help,
I got this message:
Microsoft JET Database Engine error '80040e10'
No value given for one or more required parameters.
/atakomerc/confirmbook.asp, line 34
in line 34 of my file I have:
32: set rs = server.createobject("Adodb.Recordset")
33: mysql = "select hm.hotelname, bm.cost from hotelmaster hm, bookingmaster bm where hm.hotelid = bm.hotelid and hm.hotelid = " &htid
34:rs.open mysql,cn,3,3
35:
36:if totroom = 1 then
%>
my database look like this:
I have table:HotelId, Hotelname, HotelAddress1, HotelAddress2, HotelPic,HotelPhone1, HotelPhone2, HotelFax, HotelEmail,HotelUrl, Hotelroomstotal,Hotelstar, HotelImage.
I dont know should be the problem.
I hope I will find here the right answer.
N.A
bookingmaster:HotelId, desccription, comments, cost
hotelmaster: