Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7013419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:23:05+00:00 2026-05-27T22:23:05+00:00

Object must implement IConvertible. Description: An unhandled exception occurred during the execution of the

  • 0

Object must implement IConvertible.
Description: An unhandled exception occurred during the execution of the current web request.

Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidCastException: Object must implement
IConvertible.

Error Detail Line 279:
da.InsertCommand.Parameters.Add(“@Total”, SqlDbType.Int).Value =
txttotal.Text; Line 280: con1.Open(); Line 281:
da.InsertCommand.ExecuteNonQuery();

Code:

SqlDataAdapter da = new SqlDataAdapter();
    da.InsertCommand = new SqlCommand("Insert Into customer_order(ProductID,product_Name,Product_Type,Weight,Unit_Price,No_Of_Master_Pack,Master_Pack_Price,Quantity,Total)VALUES(@ProductID,@product_Name,@Product_Type,@Weight,@Unit_Price,@No_Of_Master_Pack,@Master_Pack_Price,@Quantity,@Total)", con1);
    da.InsertCommand.Parameters.Add("@ProductID",SqlDbType.VarChar).Value=DropDownList3.SelectedItem;
    da.InsertCommand.Parameters.Add("@product_Name",SqlDbType.VarChar).Value=DropDownList2.SelectedItem;
    da.InsertCommand.Parameters.Add("@Product_Type", SqlDbType.VarChar).Value = DropDownList1.SelectedItem;
    da.InsertCommand.Parameters.Add("@Weight",SqlDbType.Int).Value=txtwgt.Text;
    da.InsertCommand.Parameters.Add("@Unit_Price",SqlDbType.Int).Value=txtmrpsinglepack.Text;
    da.InsertCommand.Parameters.Add("@No_Of_Master_Pack",SqlDbType.Int).Value=txtnoofmasterpack.Text;
    da.InsertCommand.Parameters.Add("@Master_Pack_Price",SqlDbType.Int).Value=txtmrpmaster.Text;
    da.InsertCommand.Parameters.Add("@Quantity",SqlDbType.Int).Value=txtquantity.Text;
    da.InsertCommand.Parameters.Add("@Total", SqlDbType.Int).Value = txttotal.Text;
con1.Open();
da.InsertCommand.ExecuteNonQuery();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T22:23:06+00:00Added an answer on May 27, 2026 at 10:23 pm

    ListControl.SelectedItem returns a ListItem – and it doesn’t make much sense for the value of a parameter to be a list item itself, but instead the item’s value or text. You probably want something like:

    da.InsertCommand.Parameters
      .Add("@ProductID",SqlDbType.VarChar).Value = DropDownList3.SelectedItem.Text;
    

    or

    da.InsertCommand.Parameters
      .Add("@ProductID",SqlDbType.VarChar).Value = DropDownList3.SelectedItem.Value;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting the following exception: Nullable object must have a value Everything was
The error message I receive is: At least one object must implement IComparable The
Given that users must be able to define their own fields on an object,
The documentation for -hash says it must not change while a mutable object is
I need to make a .net application where I must detect a specific object
http://msdn.microsoft.com/en-us/library/system.object.gethashcode(VS.80).aspx says: For the best performance, a hash function must generate a random distribution
If the Single Responsibility Principle states that every object must have a single reason
I am trying to clone a object of class Integer, which does implement the
How is known to support FE protocol, I must implement method: – countByEnumeratingWithState:objects:count: But
All objects used as keys in NS(Mutable)Dictionaries must support the NSCopying protocol, and those

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.