none
Parameter count does not match Parameter Value count.

    Pertanyaan

  • Parameter count does not match Parameter Value count.

    what does this mean...I am trying to update my sqldb...I have all the right parameters...why elese would this come up???

    28 September 2006 12:44

Jawaban

  •  Tryin2Bgood wrote:

    Here is my Query for the Update or Insert...its a Save Function() When i insert a breakpoint it shows me the values of whats in the Database but if i add new values to the controls it never has what was added....Like the new data is not being sent at all.....


    public void Save()
    {

    if(_CustomerID == 0)
    {

    SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionString,"Customer_Insert",
    new object[] {

    _CustomerCode,
    _Attention,
    _Class,
    _LoadType,
    _VehicleType,
    _TermNumber,
    _Status,
    _Commodity,
    _Name,
    _Address,
    _Address2,
    _City,
    _ZipCode,
    _State,
    _Country,
    _Telephone,
    _Email,
    _SelectionCode1,
    _SelectionCode2,
    _SelectionCode3,
    _SelectionCode4,
    _HasCredit,
    _FirstPurchaseDate,
    _LastPurchaseDate,
    _CreditDate,
    _AvailableCredit,
    _AvePaymentDays,
    _CreditLimit,
    _FuelPercentage,
    _IsFlatPercentage,
    _ChargePerMile,
    _ImagesPerPage,
    _Notes});
    }
    else

    {
    SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionString, "Customer_UpDate",
    new object[] {
    _CustomerID,
    _CustomerCode,
    _Attention,
    _Class,
    _LoadType,
    _VehicleType,
    _TermNumber,
    _Status,
    _Commodity,
    _Name,
    _Address,
    _Address2,
    _City,
    _ZipCode,
    _State,
    _Country,
    _Telephone,
    _Email,
    _SelectionCode1,
    _SelectionCode2,
    _SelectionCode3,
    _SelectionCode4,
    _HasCredit,
    _FirstPurchaseDate,
    _LastPurchaseDate,
    _CreditDate,
    _AvailableCredit,
    _AvePaymentDays,
    _CreditLimit,
    _FuelPercentage,
    _IsFlatPercentage,
    _ChargePerMile,
    _ImagesPerPage,
    _Notes});
    }
    }


     

    Make sure count of the above values = count of colums in the dataset you are put these records?

    Best Regards,

    28 September 2006 14:04

Semua Balasan

  • See you query again your are doing something wrong like trying to put 3 value in 4 colums or vice versa.

    Minutely debug your code and see what's the resulted query you are trying to run against the Database table.

    If dont get any clue then kindly post your query here.

    I hope this will work.

    Best Regards,

    28 September 2006 13:45
  • See here are my DataBindings...this is so i can have these values in my properties for the update.....



     

    public void LoadFormToData()
    {
    try

    {
    //txtCustomerCode.Text = Customers.CustomerCode;

    txtCustomerCode.DataBindings.Add("Text", Customers.dsInsert, "Customers.CustomerCode");
    cboLoadType.DataBindings.Add("Text",Customers.dsInsert,"Customers.LoadType");
    cboVehicleType.DataBindings.Add("Text", Customers.dsInsert, "Customers.VehicleType");
    cboCommodity.DataBindings.Add("Text", Customers.dsInsert, "Customers.Commodity");
    cboClass.DataBindings.Add("Text", Customers.dsInsert, "Customers.Class");
    cboStatus.DataBindings.Add("SelectedIndex", Customers.dsInsert, "Customers.Status");
    cboTerm.DataBindings.Add("SelectedIndex", Customers.dsInsert, "Customers.TermNumber");
    cboImagesPerPage.DataBindings.Add("SelectedIndex", Customers.dsInsert, "Customers.ImagesPerPage");

    txtName.DataBindings.Add("Text", Customers.dsInsert,"Customers.Name");
    txtAttention.DataBindings.Add("Text", Customers.dsInsert, "Customers.Attention");
    txtAddress.DataBindings.Add("Text", Customers.dsInsert, "Customers.Address");
    txtAddress2.DataBindings.Add("Text", Customers.dsInsert, "Customers.Address2");
    txtCity.DataBindings.Add("Text", Customers.dsInsert, "Customers.City");
    txtZip.DataBindings.Add("Text", Customers.dsInsert, "Customers.ZipCode");
    txtState.DataBindings.Add("Text", Customers.dsInsert, "Customers.State");
    txtCountry.DataBindings.Add("Text", Customers.dsInsert, "Customers.Country");
    txtemail.DataBindings.Add("Text", Customers.dsInsert, "Customers.Email");
    txtPhone.DataBindings.Add("Text", Customers.dsInsert, "Customers.Telephone");
    txtChargePerMile.DataBindings.Add("Text", Customers.dsInsert, "Customers.ChargePerMile.ToString()");
    txtselection1.DataBindings.Add("Text", Customers.dsInsert, "Customers.SelectionCode1");
    txtselection2.DataBindings.Add("Text", Customers.dsInsert, "Customers.SelectionCode2");
    txtselection3.DataBindings.Add("Text", Customers.dsInsert, "Customers.SelectionCode3");
    txtselection4.DataBindings.Add("Text", Customers.dsInsert, "Customers.SelectionCode4");
    chkHasCredit.DataBindings.Add("Checked", Customers.dsInsert, "Customers.HasCredit");
    txtLastPurchaseDate.DataBindings.Add("Text", Customers.dsInsert, "Customers.LastPurchaseDate.ToString()");
    txtFirstPurchaseDate.DataBindings.Add("Text",Customers.dsInsert, "Customers.FirstPurchaseDate.ToString()");
    txtCreditLimit.DataBindings.Add("Text",Customers.dsInsert,"Customers.CreditLimit.ToString()");
    dtpCreditDate.DataBindings.Add("Value", Customers.dsInsert, "Customers.CreditDate.ToString()");
    txtAvePaymentDays.DataBindings.Add("Text", Customers.dsInsert, "Customers.AvePaymentDays.ToString()");
    rbIsFlatFuelPercentage.DataBindings.Add("Checked", Customers.dsInsert, Customers.IsFlatPercentage);
    txtAvailableCredit.DataBindings.Add("Text", Customers.dsInsert, "Customers.AvailableCredit.ToString()");
    txtNotes.DataBindings.Add("Text", Customers.dsInsert, "Customers.Notes");
    }
    catch(Exception ex)
    {
    MessageBox.Show(ex.Message.ToString());
    }
    }


     

     

    Here is my Query for the Update or Insert...its a Save Function() When i insert a breakpoint it shows me the values of whats in the Database but if i add new values to the controls it never has what was added....Like the new data is not being sent at all.....


    public void Save()
    {

    if(_CustomerID == 0)
    {

    SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionString,"Customer_Insert",
    new object[] {

    _CustomerCode,
    _Attention,
    _Class,
    _LoadType,
    _VehicleType,
    _TermNumber,
    _Status,
    _Commodity,
    _Name,
    _Address,
    _Address2,
    _City,
    _ZipCode,
    _State,
    _Country,
    _Telephone,
    _Email,
    _SelectionCode1,
    _SelectionCode2,
    _SelectionCode3,
    _SelectionCode4,
    _HasCredit,
    _FirstPurchaseDate,
    _LastPurchaseDate,
    _CreditDate,
    _AvailableCredit,
    _AvePaymentDays,
    _CreditLimit,
    _FuelPercentage,
    _IsFlatPercentage,
    _ChargePerMile,
    _ImagesPerPage,
    _Notes});
    }
    else

    {
    SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionString, "Customer_UpDate",
    new object[] {
    _CustomerID,
    _CustomerCode,
    _Attention,
    _Class,
    _LoadType,
    _VehicleType,
    _TermNumber,
    _Status,
    _Commodity,
    _Name,
    _Address,
    _Address2,
    _City,
    _ZipCode,
    _State,
    _Country,
    _Telephone,
    _Email,
    _SelectionCode1,
    _SelectionCode2,
    _SelectionCode3,
    _SelectionCode4,
    _HasCredit,
    _FirstPurchaseDate,
    _LastPurchaseDate,
    _CreditDate,
    _AvailableCredit,
    _AvePaymentDays,
    _CreditLimit,
    _FuelPercentage,
    _IsFlatPercentage,
    _ChargePerMile,
    _ImagesPerPage,
    _Notes});
    }
    }


     

     

    here is the dsInsert method that should be filling it with my Customers_Select all stored proc

     


    public void GetCustomerByID()
    {
    _dsInsert = SqlHelper.ExecuteDataset(SqlHelper.ConnectionString, "Customers_All",
    null);

    }

     

     

    28 September 2006 13:53
  •  Tryin2Bgood wrote:

    Here is my Query for the Update or Insert...its a Save Function() When i insert a breakpoint it shows me the values of whats in the Database but if i add new values to the controls it never has what was added....Like the new data is not being sent at all.....


    public void Save()
    {

    if(_CustomerID == 0)
    {

    SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionString,"Customer_Insert",
    new object[] {

    _CustomerCode,
    _Attention,
    _Class,
    _LoadType,
    _VehicleType,
    _TermNumber,
    _Status,
    _Commodity,
    _Name,
    _Address,
    _Address2,
    _City,
    _ZipCode,
    _State,
    _Country,
    _Telephone,
    _Email,
    _SelectionCode1,
    _SelectionCode2,
    _SelectionCode3,
    _SelectionCode4,
    _HasCredit,
    _FirstPurchaseDate,
    _LastPurchaseDate,
    _CreditDate,
    _AvailableCredit,
    _AvePaymentDays,
    _CreditLimit,
    _FuelPercentage,
    _IsFlatPercentage,
    _ChargePerMile,
    _ImagesPerPage,
    _Notes});
    }
    else

    {
    SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionString, "Customer_UpDate",
    new object[] {
    _CustomerID,
    _CustomerCode,
    _Attention,
    _Class,
    _LoadType,
    _VehicleType,
    _TermNumber,
    _Status,
    _Commodity,
    _Name,
    _Address,
    _Address2,
    _City,
    _ZipCode,
    _State,
    _Country,
    _Telephone,
    _Email,
    _SelectionCode1,
    _SelectionCode2,
    _SelectionCode3,
    _SelectionCode4,
    _HasCredit,
    _FirstPurchaseDate,
    _LastPurchaseDate,
    _CreditDate,
    _AvailableCredit,
    _AvePaymentDays,
    _CreditLimit,
    _FuelPercentage,
    _IsFlatPercentage,
    _ChargePerMile,
    _ImagesPerPage,
    _Notes});
    }
    }


     

    Make sure count of the above values = count of colums in the dataset you are put these records?

    Best Regards,

    28 September 2006 14:04
  • Is your problem solved?

    28 September 2006 15:21
  • No its not solved....Its telling me i have an invalid cast from Date to Boolean....but even still when i use the call stack my values are not being commited to the save object's property
    28 September 2006 15:51
  • Might help if you actually ask the problem on a related forum.  This really doesn't have anything specific to do with "Visual C# Language"
    28 September 2006 16:03
  • Definitely it wont save untill your query is successfull!!!
    28 September 2006 16:09
  • If i enter a value like ID and it pulls up all the information for that ID then after that i make some changes...Why does it show in the call stack that these values are assigned to the properties....If the querey fails it should show all null data right???
    28 September 2006 16:33
  • the problem may appear to be that in your stored procedure (find out which line it fails at in your C# code) the number of parameters it expects is not the same as what you have supplied.

    This is what the cause is most likely. What line does the code fail at?

    28 September 2006 17:10
  • that the thing how do i find out which line fails using the stored proc...They say stored procs are the best way to go but...I can use a MessageBox.Show() and pass it the sql command and it will show me exacltly whats being sent to the server if i just write the query in the code and set the parameters to the controls....Can i do something like that using a stored proc????
    28 September 2006 17:18
  • SPROCS are the best way to go. What I am saying is, when you execute non query command, is that where the error is produced? If so, check the parameter count. Then check your SPROC parameters (go into SQL and look at the SPROC)...count how many there are. Do they match up? if not - that's your problem.
    28 September 2006 17:31