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 21st, 2005, 01:34 PM
Registered User
 
Join Date: Mar 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default No value given for one or more required parameters

Hello everyone,
I'm having problems with this code. I'm connecting to an access database where the primary key data type is text and my the field name is "Fname" (First Name). I keep getting this error:

No value given for one or more required parameters

I don't get the same error if I change my primary key to AutoNumber. Please let me know if I have to use a numbered primary key or can I use text and how can I fix the code to work with it. Here's the code I'm using:


Dim oConn, rs

Set oConn = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset")
oConn.Open = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
              "Data Source=database.mdb;" & _
              "Persist Security Info=False"


If Request("Fname") <> "" THEN
IDReq = Request("Fname")
rs.open "SELECT * FROM table WHERE Fname=" & IDReq,oConn,1,1

If Not rs.EOF Then
rs.MoveFirst

Thank you in advance.
 
Old December 21st, 2005, 06:44 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

If FName is a text type then you need to enclose it in quotes:

rs.open "SELECT * FROM table WHERE Fname='" & IDReq & "'", oConn, 1, 1


HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Sleeping With Ghosts by Placebo (Track 4 from the album: Sleeping with Ghosts) What's This?





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 djatsii Classic ASP Databases 16 January 4th, 2006 05:49 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.