3 Replies - 2537 Views - Last Post: 15 February 2010 - 10:25 PM Rate Topic: -----

#1 avirag   User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 92
  • Joined: 29-June 09

Error: No value given for one or more required parameters

Posted 15 February 2010 - 01:43 AM

Hi!!!

I ma making a school management application using visual studio2008, MS Access database, C#.
There are two tables: "Class" with fields c_id , c_name
"Section" with fields c_name , sec_id, sec_name.

On the form I have two combobox one for class named "com_Class" and other for section named "com_Section" .I want that when I select any class from "com_Class" then the sections( corresponding to that particular selected class) should display in "com_Section" and not all the sections.

I am using following code :
private void com_Class_SelectedIndexChanged(object sender, EventArgs e)
        {
                    
          
                
                cls_Con.comboFill(this.com_Section, "select sec_name from [section] where c_name="+com_Class.SelectedItem.ToString()+"", "[section]", "sec_name", "sec_id");
               
            }




Here I am getting error: No value given for one or more required parameters.

Kindly provide some solution.

Is This A Good Question/Topic? 0
  • +

Replies To: Error: No value given for one or more required parameters

#2 n8wxs   User is offline

  • --... ...-- -.. . -. ---.. .-- -..- ...
  • member icon

Reputation: 972
  • View blog
  • Posts: 3,878
  • Joined: 07-January 08

Re: Error: No value given for one or more required parameters

Posted 15 February 2010 - 03:58 AM

cls_Con.comboFill() is not a .NET method. How many and what kind of arguments it takes are unknown to me. No solution is possible without your posting the method's code.

This post has been edited by n8wxs: 15 February 2010 - 04:00 AM

Was This Post Helpful? 0
  • +
  • -

#3 Adkins   User is offline

  • D.I.C Addict
  • member icon

Reputation: 66
  • View blog
  • Posts: 560
  • Joined: 27-October 09

Re: Error: No value given for one or more required parameters

Posted 15 February 2010 - 05:10 AM

With the info you have provided all I can say is that one of the parameters that you defined for your method comboFill are not being used properly. Look over the signature for the method and then over the call one more time to make sure everything there is good. If not then you have your answer. If so then please paste the method here so we have a little more info to go off of.
Was This Post Helpful? 0
  • +
  • -

#4 avirag   User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 92
  • Joined: 29-June 09

Re: Error: No value given for one or more required parameters

Posted 15 February 2010 - 10:25 PM

View Postn8wxs, on 15 February 2010 - 02:58 AM, said:

cls_Con.comboFill() is not a .NET method. How many and what kind of arguments it takes are unknown to me. No solution is possible without your posting the method's code.



I have a class(clsODBC.cs) for database connectivity and in that I have make function comboFill() and the code is as follows:
public void comboFill(ComboBox cmb, string strSQL, string dTable, string dDisplay, string dValue)
        {
            try
            {
                cmb.DropDownStyle = ComboBoxStyle.DropDownList;
                //OleDbCommand cmd = new OleDbCommand();
                DataSet ds = new DataSet();
                OleDbDataAdapter da = new OleDbDataAdapter(strSQL, cn);
                da.Fill(ds, dTable);
                cmb.DataSource = ds.Tables[dTable].DefaultView;
                cmb.DisplayMember = dDisplay;
                cmb.ValueMember = dValue;
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message);
            }


In clsODBC.cs, I have written complate code for database connectivity and to access this class in each form I have added following statement in each form:
_class.clsODBC cls_Con = new School._class.clsODBC();
        OleDbCommand cmdForm = new OleDbCommand();



Now , kindly give me some solution for my problem
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1