 |
| 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
|
|
|
|

December 30th, 2005, 09:21 AM
|
|
Registered User
|
|
Join Date: Dec 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
No value given for one or more required parameters
need help... what am I doing wrong? thanks in advance...
<html>
<%
'***********************************
' 1 Step Connect the Database
'***********************************
set conn = Server.CreateObject("Adodb.Connection")
conn.ConnectionString="Provider=Microsoft.Jet.OLED B.4.0;Data Source=C:\Inetpub\wwwroot\ssc.mdb;Persist Security Info=False"
conn.open
'***********************************
' 2 Execute Insert Command
'***********************************
dim strdml
dim xcustomer_id
dim xcompany_name
dim xcontact_name
dim xcontact_title
dim xaddress
dim xcity
dim xregion
dim xpostal_code
dim xcountry
dim xphone
dim xfax
xcustomer_id=request.form("txtcustid")
xcompany_name=request.form("txtcompanyname")
xcontact_name=request.form("txtcontactname")
xcontact_title=request.form("txtcontacttitle")
xaddress=request.form("txtaddress")
xcity=request.form("txtcity")
xregion=request.form("txtregion")
xpostal_code=request.form("txtpostalcode")
xcountry=request.form("txtcountry")
xphone=request.form("txtphone")
xfax=request.form("txtfax")
strdml ="Insert into Customers(Customer_ID, Company_Name, Contact_Name, Contact_Title, Address, City, Region, Postal_Code, Country, Phone, Fax) values("&xcustomer_id&",'"&xcompany_name&"','"&xco ntact_name&"','"&xcontact_title&"','"&xaddress&"', '"&xcity&"','"&xregion&"','"&xpostal_code&"','"&xc ountry&"','"&xphone&"','"&xfax&"')"
conn.execute strdml
conn.close
%>
<center><h1>Record Successfully Inserted</h1></center>
jacky
|
|

December 30th, 2005, 09:45 AM
|
|
Registered User
|
|
Join Date: Dec 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
by the way, customer_ID is a string, thanks
jacky
|
|

December 30th, 2005, 09:58 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Quote:
|
quote:by the way, customer_ID is a string
|
In that case, you should enclose the value in single quotes, just like you did with other columns.
If that doesn't help, write out strdml using Response.Write(strdml) and post the results of that to this thread.
HtH,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

December 30th, 2005, 01:05 PM
|
|
Registered User
|
|
Join Date: Dec 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Insert into Customers(Customer_ID, Company_Name, Contact_Name, Contact_Title, Address, City, Region, Postal_Code, Country, Phone, Fax) values(this is customer id,'this is company name','this is contact name','','this is address','this is a city','this is a region','05012','this is a country','7243061','1535556')
Record Successfully Inserted
thanks :)
jacky
|
|

December 30th, 2005, 01:12 PM
|
|
Registered User
|
|
Join Date: Dec 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
it's not retrieving contact_title.... ???? :(
jacky
|
|

December 30th, 2005, 03:36 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Indeed the title seems empty. However, this is more likely the problem:
Quote:
|
quote:In that case, you should enclose the value in single quotes, just like you did with other columns.
|
You haven't done that yet...
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

January 3rd, 2006, 10:45 AM
|
|
Registered User
|
|
Join Date: Dec 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
which value should i enclose with single quotes? sorry about that...
jacky
|
|

January 3rd, 2006, 10:58 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
The Customer_ID. Take a look at this:
values(this is customer id,'this
As you can see, this is customer is not enclosed in quotes, so the database has no idea what you're saying.
Change it to:
values('this is customer id','this
Basically, only numeric fields do not use quotes...
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

January 4th, 2006, 04:46 AM
|
|
Authorized User
|
|
Join Date: Jan 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
<form method="post">
Id :<input type="text" name="Id" size=10>
Order NO:<input type="text" name="orderno" size=10>
<input type="submit" value="Submit">
</form>
<%'Establish database connection-------
Dim objrs, objcon,strcon,Id,orderno
Id = Request.Form("Id")
orderno=Request.Form("orderno")
strcon="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Inetpub\wwwroot\project\Id.mdb;"
Set objcon = Server.CreateObject("ADODB.Command")
objcon.ActiveConnection= strcon
objcon.CommandText="INSERT INTO Id (orderno,Id) VALUES (orderno,Id)"
Set objrs = objcon.Execute
objcon.CommandText="select * From Id"
set objrs=objcon.Execute
while not objrs.EOF
Response.write objrs ("Id")
Response.write objrs ("orderno")
objrs.MoveNext
wend
objrs.Close
set objrs = nothing
'objcon.Close
Set objcon = nothing
%>
This is my code & the error cmes with this is
Error Type:
Microsoft JET Database Engine (0x80040E10)
No value given for one or more required parameters.
/project/order.asp, line 15
Please help because i have to finish it today
|
|

January 4th, 2006, 04:52 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
Look at the first post made by djatsii and look at the line that starts with
strdml ="Insert into
That should give you a clue as to how you should build your SQL statement as this:
objcon.CommandText="INSERT INTO Id (orderno,Id) VALUES (orderno,Id)"
clearly doesn't work. You need to add the values of orderno and Id to the SQL statement.
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|
 |