473,403 Members | 2,366 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Procedure or function ... has too many arguments specified.

i have multiple checkboxes on my form.i am trying to add them with stored procedure but it gives me Procedure or function konut_ekle has too many arguments specified


Expand|Select|Wrap|Line Numbers
  1. protected void Button1_Click1(object sender, EventArgs e)
  2.     {
  3.  
  4.         SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["connectionString"].ConnectionString);
  5.         SqlCommand cmd;
  6.         con.Open();
  7.         string cmdstr = "konut_ekle";
  8.         cmd = new SqlCommand(cmdstr, con);
  9.         cmd.CommandType = CommandType.StoredProcedure;
  10.         cmd.Parameters.AddWithValue("@kategori", TextBox1.Text);
  11.         cmd.Parameters.AddWithValue("@tip", TextBox2.Text);
  12.         cmd.Parameters.AddWithValue("@il", TextBox3.Text);
  13.         cmd.Parameters.AddWithValue("@ilce", TextBox4.Text);
  14.         cmd.Parameters.AddWithValue("@semt", TextBox5.Text);
  15.         cmd.Parameters.AddWithValue("@fiyat", TextBox7.Text);
  16.         for (int i = 0; i < CheckBoxList1.Items.Count; i++)
  17.         {
  18.             if (CheckBoxList1.Items[i].Selected)
  19.             {
  20.                 cmd.Parameters.AddWithValue("@ozellik", CheckBoxList1.Items[i].Value);
  21.             }
  22.         }
  23.         cmd.ExecuteNonQuery();
  24.         cmd.Dispose();
  25.         con.Close();
  26.     }protected void Button1_Click1(object sender, EventArgs e)
  27.     {
  28.  
  29.         SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["connectionString"].ConnectionString);
  30.         SqlCommand cmd;
  31.         con.Open();
  32.         string cmdstr = "konut_ekle";
  33.         cmd = new SqlCommand(cmdstr, con);
  34.         cmd.CommandType = CommandType.StoredProcedure;
  35.         cmd.Parameters.AddWithValue("@kategori", TextBox1.Text);
  36.         cmd.Parameters.AddWithValue("@tip", TextBox2.Text);
  37.         cmd.Parameters.AddWithValue("@il", TextBox3.Text);
  38.         cmd.Parameters.AddWithValue("@ilce", TextBox4.Text);
  39.         cmd.Parameters.AddWithValue("@semt", TextBox5.Text);
  40.         cmd.Parameters.AddWithValue("@fiyat", TextBox7.Text);
  41.         for (int i = 0; i < CheckBoxList1.Items.Count; i++)
  42.         {
  43.             if (CheckBoxList1.Items[i].Selected)
  44.             {
  45.                 cmd.Parameters.AddWithValue("@ozellik", CheckBoxList1.Items[i].Value);
  46.             }
  47.         }
  48.         cmd.ExecuteNonQuery();
  49.         cmd.Dispose();
  50.         con.Close();
  51.     }
  52.  
  53.  

Expand|Select|Wrap|Line Numbers
  1.  
  2. ALTER PROCEDURE konut_ekle
  3. @kategori varchar(50),
  4. @tip varchar(50),
  5. @il varchar(50),
  6. @ilce varchar(50),
  7. @semt varchar(50),
  8. @fiyat varchar(50),
  9. @ozellik varchar(50)
  10. AS
  11.  
  12.  
  13. SET NOCOUNT ON
  14.  
  15.  
  16.  
  17.     insert into ilan (kategori,tip,il,ilce,semt)
  18.     values (@kategori,@tip,@il,@ilce,@semt)
  19.  
  20.     declare @ilanid varchar(50)
  21.  
  22.     set @ilanid = scope_identity()
  23.  
  24.     insert into konut(ilanid,fiyat) values (@ilanid,@fiyat)
  25.  
  26.     insert into ozellikler(ilanid,ozellik) values (@ilanid,@ozellik)
  27.  
  28.     RETURNALTER PROCEDURE konut_ekle
  29. @kategori varchar(50),
  30. @tip varchar(50),
  31. @il varchar(50),
  32. @ilce varchar(50),
  33. @semt varchar(50),
  34. @fiyat varchar(50),
  35. @ozellik varchar(50)
  36. AS
  37.  
  38.  
  39. SET NOCOUNT ON
  40.  
  41.  
  42.  
  43.     insert into ilan (kategori,tip,il,ilce,semt)
  44.     values (@kategori,@tip,@il,@ilce,@semt)
  45.  
  46.     declare @ilanid varchar(50)
  47.  
  48.     set @ilanid = scope_identity()
  49.  
  50.     insert into konut(ilanid,fiyat) values (@ilanid,@fiyat)
  51.  
  52.     insert into ozellikler(ilanid,ozellik) values (@ilanid,@ozellik)
  53.  
  54.     RETURN
  55.  
Jun 11 '09 #1
1 7106
Plater
7,872 Expert 4TB
You are trying to add multiple parameters with the same name. Pretty sure you cannot do that.
Jun 11 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my...
3
by: Justin | last post by:
I am trying to do a simple update of a database using a stored procedure. I have get the following error when executing the code: "Procedure or function UpdateDetails has too many arguments...
1
by: Child | last post by:
Hi, I am getting the error: "Procedure or function spAddActivity has too many arguments specified. " on a stored procedure insert. I compared the number of parameters in the function and the SP...
22
by: M K | last post by:
Heres my SP: ( i am trying to add more than 1 field but get the same error no matter how many i try to add, i thought i would try to insert the primary key only and work up from there but the...
9
by: Leedrick | last post by:
Hi, In the past I have been dealing mainly with sql server, and recently been given the task of supporting software that uses db2 on as400. Simple tasks such as executing a stored procedure...
0
by: Mike P | last post by:
I am using a SqlDataSource with a GridView and stored proc, and I have specified exactly the same update parameters for the SqlDataSource in exactly the same order as my stored proc. Yet I keep...
1
by: jkeel | last post by:
If I try to Update a record with the following code using a stored procedure I get an error: <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$...
2
by: sun919 | last post by:
hi there... i ve a little question asking concerning saving data into database Basically, I have stored procedure name InsertquestionnaireList and the argument for this is both correct ... I...
0
by: David Lozzi | last post by:
Howdy, ASP.Net 2.0 using VB on SQL 2005 This is a two fold issue. I have a DetailsView control which users can insert or edit items. Editing works great. Insert works great however I need...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.