473,795 Members | 3,440 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Prepared statement expects parameter which was not supplied

Prepared statement '(@p1 int,@p2 tinyint,@p3 varchar(8000),@ p4
varchar(8000),@ p5 bit' expects parameter @p1, which was not supplied.

I get the above error when trying to update a datagridview to the sql
database. I am using the commandbuilder because the datagridview can
be saving 8 different types of data (to different tables) depending
upon the selection made in a Treeview control.

The same code without the parameters line works properly for other
sources of data:

Here is the affected section of code.

daQuestionItems .UpdateCommand = CB.GetUpdateCom mand
daQuestionItems .UpdateCommand. Parameters("@p1 ").Value =
CInt(s.SurveyId )
daQuestionItems .Update(dsChang es, "questionItems" )

Iterating the parameters collection show this value is populated, and
trying to do an add fails because the parameter is already declared.

I'm working in vb2005 with sql server 2000.

Any help would be appreciated.

jt

Feb 27 '07 #1
1 6877
Have you checked the query and other info generated by the CommandBuilder?
Most people don't use that because it's kind of kludgey. You could try
building your own properties for it, like the query, and see if it works
that way, and if it does, then you have more information about what might
be wrong with it.

Robin S.

<jf*******@yaho o.comwrote in message
news:11******** **************@ k78g2000cwa.goo glegroups.com.. .
Prepared statement '(@p1 int,@p2 tinyint,@p3 varchar(8000),@ p4
varchar(8000),@ p5 bit' expects parameter @p1, which was not supplied.

I get the above error when trying to update a datagridview to the sql
database. I am using the commandbuilder because the datagridview can
be saving 8 different types of data (to different tables) depending
upon the selection made in a Treeview control.

The same code without the parameters line works properly for other
sources of data:

Here is the affected section of code.

daQuestionItems .UpdateCommand = CB.GetUpdateCom mand
daQuestionItems .UpdateCommand. Parameters("@p1 ").Value =
CInt(s.SurveyId )
daQuestionItems .Update(dsChang es, "questionItems" )

Iterating the parameters collection show this value is populated, and
trying to do an add fails because the parameter is already declared.

I'm working in vb2005 with sql server 2000.

Any help would be appreciated.

jt

Feb 28 '07 #2

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

Similar topics

1
3232
by: Senthil | last post by:
Hi, I created a stored procedure in the sql server. I try to insert a record from the aspx page. But I keep getting this error, "procedure expects parameter <@firstname>, which was not supplied". This is what I am doing. cmd.CommandText = "proc_insertuser"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@firstname", SqlDbType.VarChar, 50);
8
9292
by: No one | last post by:
I am trying to create a prepared statement in ASP, but am having problems with creating the parameter object. I do the following Set fnParam = peopleUpdate.CreateParameter("@firstname", adVarChar, adParamInput, 50, peopleSourceRS("firstname")) But this gives the following error on the browser: Error Type: ADODB.Command (0x800A0BB9)
0
2630
by: Rujuta Gandhi | last post by:
Hi all, I want to use prepared statement in which the where clause is to be passed as a parameter. I dont know how to get the where clause from a cube as a tuple as the error coming after the call to prepare function of the Adomdcommand object says that -- The WHERE clause function expects a tuple set expression for the argument. A string or numeric expression was used.
2
2736
by: ojorus | last post by:
Hi! Some questions regarding the mysqli-extension (php5) 1) Prepared statements: If I understand things right, prepared statements will give better performance if you make several similar querys. (where you only change the parameters) But what if you do only ONE query; will it then be usefull to use prepared statements? Can it actuelly give better performance NOT to use prepared statements in that case? 2) Are there any DISadvantages...
0
5941
by: Maneesh Agarwal | last post by:
I am trying to pass a parameter to dynamically populate drop down list. I am not able to pass the parameter from my .aspx file. Here is the grid view and related ObjectDataSource. In srcLocation, the Company paramter being passed is blank or null, if I put default value (hardcoding what is expected), the page display fine when I click on edit button. But with no default value it gives above error. <asp:GridView id="grdCAPAs" ...
4
2485
by: TechieGrl | last post by:
Prepared statements are new to me and having to do this with a multi- dimensional array is beyond me. Here is the prepared statement block: // Prepare to insert a record into table1 $flag_insert = false; $sql_insert = "INSERT IGNORE INTO table1 "; $sql_insert .= "(ID, url)"; $sql_insert .= "VALUES ";
0
1472
by: itamar82 | last post by:
I have a SP running on mssql server 2005. When I try to execute the SP through asp I receive back an error that the parameter @City is not supplied, although I clearly do supply it. Here is my code: SP: CREATE PROCEDURE . @Id int output, @Name varchar(100), @Comments text = NULL,
7
1348
by: Cirene | last post by:
I have a stored procedure named insertcompany. I keep getting the error: Sys.webforms.pagerequestmanagerservererrorexception: Procedure or function 'InsertCompany' expects parameter '@ApptPhone1Required', which was not supplied. But, I DID supply it along with all others.... (here's a snippet) MyCommand.Parameters.AddWithValue("@InstructionsOperator",
6
9666
by: Gordon | last post by:
I want to search a folder structure represented in a database. I'm using the ID and Parent columns model, and would like to be able to search a folder's subfolders as well as teh folder itself. To do this I'm getting a list of all the subfolders with a recursive function and building them into a CSV list of IDs. Example output: 472,944,925,931,938,1692,1005,1036,1046,1051,1042,1816,1819,921 I then want to do a select against the list...
0
9672
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
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10437
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...
1
10164
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7538
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
6780
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
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3723
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.