Wrox Programmer Forums
|
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
 
Old December 30th, 2005, 09:21 AM
Registered User
 
Join Date: Dec 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to djatsii Send a message via Yahoo to djatsii
Default 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
 
Old December 30th, 2005, 09:45 AM
Registered User
 
Join Date: Dec 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to djatsii Send a message via Yahoo to djatsii
Default

by the way, customer_ID is a string, thanks

jacky
 
Old December 30th, 2005, 09:58 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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.
 
Old December 30th, 2005, 01:05 PM
Registered User
 
Join Date: Dec 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to djatsii Send a message via Yahoo to djatsii
Default

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
 
Old December 30th, 2005, 01:12 PM
Registered User
 
Join Date: Dec 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to djatsii Send a message via Yahoo to djatsii
Default

it's not retrieving contact_title.... ???? :(

jacky
 
Old December 30th, 2005, 03:36 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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.
 
Old January 3rd, 2006, 10:45 AM
Registered User
 
Join Date: Dec 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to djatsii Send a message via Yahoo to djatsii
Default

which value should i enclose with single quotes? sorry about that...

jacky
 
Old January 3rd, 2006, 10:58 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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.
 
Old January 4th, 2006, 04:46 AM
Authorized User
 
Join Date: Jan 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default


<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


 
Old January 4th, 2006, 04:52 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Some help required ! codenet C# 2005 1 September 24th, 2007 04:01 PM
No value given for one or more required parameters ableton ADO.NET 2 July 18th, 2006 02:12 AM
No value given for one or more required parameters imercha Classic ASP Databases 1 December 21st, 2005 06:44 PM
No value given for one or more required parameters vlado Classic ASP Databases 10 October 5th, 2004 09:10 PM
No value given for one or more required parameters nidy_online ADO.NET 1 June 27th, 2004 09:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.