You must Sign In to post a response.
  • Category: ASP.NET

    Storing Data in a Database.

    Hi,

    I have a web form which takes CV details of a user. Once the user clicks submit it is supposed to place this information in the appropriate table.

    However, I'm getting this error: "An exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll but was not handled in user code

    Additional information: Column name or number of supplied values does not match table definition."
  • #763150
    Hai Luke,
    The error message "Column name or number of supplied values does not match table definition." clearly says that the number of parameters are not same in count with the table columns.
    So you need to check the table columns and accordingly you need to provide the parameters.
    Hope it will be helpful to you.

    Regards,
    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)
    pawansoftit@gmail.com

  • #763155
    Hello Luke,

    Column name or number of supplied values does not match table definition means that the value or parameters you are passing while inserting data to table which is less or more.

    Sample :
    Table Name : JobSeekers
    Columns : SeekerID, SeekerName

    Correct INSERTION query :--> INSERT INTO JobSeekers VALUES('JS001', 'Nirav Lalan');

    Your assumed query :--> INSERT INTO JobSeekers VALUES('JS001');
    Or
    INSERT INTO JobSeekers VALUES('JS001', 'Nirav Lalan', 'Extra value');


    So just go through it and check your table columns and the parameters you are passing while inserting data to table whether it matches the column definition or not.

    Regards,
    Nirav Lalan
    DNS Gold Member
    "Failure is the path of least persistence"

  • #763166
    Check the number of columns in table and values supplied to insert query. If you want to insert values in only some columns then specifies column names in insert query .

  • #763168
    Hi,

    As per error "Column name or number of supplied values does not match table definition" it clearly suggested that no of columns which you passed is exceed the table columns. I request you to please recheck the count of columns of table as well as your querying parameters.

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/

  • #763226
    Hi,

    you should check number values in your front end and how many values passed your backend db.


    Hope this will help

    Regards
    Sriram.R


Sign In to post your comments