473,770 Members | 6,978 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"No value given for one or more required parameters" Error

Hello,

When I execute the code below, I get:

"Microsoft JET Database Engine (0x80040E10)
No value given for one or more required parameters." error message in
the first line.

Rs.Open "SELECT * From Unvanlar WHERE Unvan = " & kayit8, Con, 3,3
If rs.EOF Then
Con.Execute ("INSERT INTO Unvanlar (Unvan) VALUES
('"&kayit8&"')" ),,129
End If
Rs.Close

The variable is string and the field in access table is text. I'm sure
that field names in the code and table are correct as well.

What can I do to solve that?

Apr 5 '06 #1
3 11778

Grayscale wrote:
Hello,

When I execute the code below, I get:

"Microsoft JET Database Engine (0x80040E10)
No value given for one or more required parameters." error message in
the first line.

Rs.Open "SELECT * From Unvanlar WHERE Unvan = " & kayit8, Con, 3,3
If rs.EOF Then
Con.Execute ("INSERT INTO Unvanlar (Unvan) VALUES
('"&kayit8&"')" ),,129
End If
Rs.Close

The variable is string and the field in access table is text. I'm sure
that field names in the code and table are correct as well.

What can I do to solve that?


If Unvan is a text field, the variable should be delimited as text:

WHERE Unvan = '" & kayit9 & "'"

You would have found that out if you response.write your sql

sql = "SELECT * From Unvanlar WHERE Unvan = '" & kayit9 & "'"
'response.write sql
rs.open sql con,3,3

But why are you selecting * from the table when you are only checking
to see if one value exists?

sql = "SELECT Unvan From Unvanlar WHERE Unvan = '" & kayit9 & "'"
'response.write sql
rs.open sql con,3,3

The cursor you are using is this context is expensive and unnecessary.
The default one would be better.

sql = "SELECT Unvan From Unvanlar WHERE Unvan = '" & kayit9 & "'"
'response.write sql
rs.open sql con,,1

I'd mention to you the dangers of using dynamic SQL, but I notice that
Bob Barrows has already done so in a previous post.

--
Mike Brind

Apr 5 '06 #2
Grayscale wrote:
Hello,

When I execute the code below, I get:

"Microsoft JET Database Engine (0x80040E10)
No value given for one or more required parameters." error message in
the first line.

Rs.Open "SELECT * From Unvanlar WHERE Unvan = " & kayit8, Con, 3,3
If rs.EOF Then
Con.Execute ("INSERT INTO Unvanlar (Unvan) VALUES
('"&kayit8&"')" ),,129
the syntax here is incorrect - see below:
End If
Rs.Close

The variable is string and the field in access table is text. I'm sure
that field names in the code and table are correct as well.

What can I do to solve that?

You cannot solve ssql syntax issues without seeing the actual sql statements
being executed by the database. That means you need to see the result of
your concatenations:

sql="SELECT * From Unvanlar WHERE Unvan = " & kayit8
response.write sql
rs.open sql, Con, 3,3
....
sql="INSERT INTO Unvanlar (Unvan) VALUES ('" & kayit8 & "')"
response.write sql
Con.Execute (sql,,129)

You will, of course, comment out the response.write statements when
everything is running correctly.
I believe fixing the syntax of your Execute call should solve your problem
so I will leave you with this:

Further points to consider:
You use of dynamic sql is leaving you vulnerable to hackers using sql
injection:
http://mvp.unixwiz.net/techtips/sql-injection.html
http://www.sqlsecurity.com/DesktopDefault.aspx?tabid=23

See here for a better, more secure way to execute your queries by using
parameter markers:
http://groups-beta.google.com/group/...e36562fee7804e

Personally, I prefer using stored procedures, or saved parameter queries as
they are known in Access:

Access:
http://www.google.com/groups?hl=en&l...TNGP12.phx.gbl

http://groups.google.com/groups?hl=e...tngp13.phx.gbl

Bob barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Apr 5 '06 #3

Mike Brind wrote:
Grayscale wrote:
Hello,

When I execute the code below, I get:

"Microsoft JET Database Engine (0x80040E10)
No value given for one or more required parameters." error message in
the first line.

Rs.Open "SELECT * From Unvanlar WHERE Unvan = " & kayit8, Con, 3,3
If rs.EOF Then
Con.Execute ("INSERT INTO Unvanlar (Unvan) VALUES
('"&kayit8&"')" ),,129
End If
Rs.Close

The variable is string and the field in access table is text. I'm sure
that field names in the code and table are correct as well.

What can I do to solve that?


If Unvan is a text field, the variable should be delimited as text:

WHERE Unvan = '" & kayit9 & "'"

You would have found that out if you response.write your sql

sql = "SELECT * From Unvanlar WHERE Unvan = '" & kayit9 & "'"
'response.write sql
rs.open sql con,3,3

But why are you selecting * from the table when you are only checking
to see if one value exists?

sql = "SELECT Unvan From Unvanlar WHERE Unvan = '" & kayit9 & "'"
'response.write sql
rs.open sql con,3,3

The cursor you are using is this context is expensive and unnecessary.
The default one would be better.

sql = "SELECT Unvan From Unvanlar WHERE Unvan = '" & kayit9 & "'"
'response.write sql
rs.open sql con,,1

I'd mention to you the dangers of using dynamic SQL, but I notice that
Bob Barrows has already done so in a previous post.

--
Mike Brind


Oops. Missed out the comma after sql in the above:

rs.open sql, con,,1

Apr 5 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2201
by: Trey Guy | last post by:
I have an ASP page I use as a front end to an Access db. I am running a query from that page that is returning a "Too few parameters..." error. The query works fine in Access. I have checked all field names and they are correct. The SQL is below. Any ideas as to the cause of this error? Thanks, Trey SELECT qryParticipantOutcomesAggregate.IndID, Indicators.IndName, Sum(qryParticipantOutcomesAggregate.NEligible) AS SumOfNEligible,
134
7913
by: James A. Donald | last post by:
I am contemplating getting into Python, which is used by engineers I admire - google and Bram Cohen, but was horrified to read "no variable or argument declarations are necessary." Surely that means that if I misspell a variable name, my program will mysteriously fail to work with no error message. If you don't declare variables, you can inadvertently re-use an variable used in an enclosing context when you don't intend to, or
3
8835
by: Brian Foree | last post by:
I am developing an ASP.NET application that uses Access 2000 as its backend, and have just started getting the following error on 2 ASP.NET pages that had been working until late last week (and I don't think I made any changes to either page other than changing the user control that creates the header). Server Error in '/myApp' Application. ---------------------------------------------------------------------------- ----
0
2183
by: Carl Gilbert | last post by:
Hi I am trying to use a custom attribute that takes in an array or list of custom objects. Ths custom object has a text property and a type property. I have a custom attribute which has a constructor that takes a class as follows: ======================================================= Public Class MyAttribute Inherits System.Attribute
2
1765
by: holysmokes99 | last post by:
I am developing a component in .Net 1.1, and want to debug it using the "start external program" of the debugger in the IDE. The program I want to start references both 1.1 and 2.0 components. The problem is that when I launch this from VS2003, the external program starts only for a moment and then bails out of memory with no error, and the ide returns to a stopped state awaiting my input. If I remove the 2.0 framework, at least the...
21
7859
by: comp.lang.tcl | last post by:
set php {<? print_r("Hello World"); ?>} puts $php; # PRINTS OUT <? print_r("Hello World"); ?> puts When I try this within TCL I get the following error:
2
2495
by: jj555s | last post by:
I get a Message that says "No error occured." when I tried to write in a file. What does it mean?
2
1852
bugboy
by: bugboy | last post by:
Hi i'm a beginner at php and my simple web query page doesn't work.. i swear i had it working at one point but now i've come back to it it doesn't. • My form works • My DB connection works • My query works in my client... so it should work here. It has the right DB and all the right table names... i've only changed the word = 'myword' to word = '$word' so it will use the form value instead. • My while loop doesn't return results.....
10
7645
by: andersond | last post by:
On a webpage that has a variety of questions I get an "object required" error on lines like this... document.getElementById('tableQuestion17').style.visibility="visible"; This is the code for the table "tableQuestion17" <table border="0" width="100%" id="tableQuestion17" cellpadding="0" style="visibility:hidden">
0
9591
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10228
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9869
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7415
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6676
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5312
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3575
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.