Skip to content

ArgumentExecption was unhandled...HELP

Forgottenhart

Asked Aug 4, 2007, 12:18 PM EDT2 answers
Share
LinkedInX

Well I have gotten the code to compile.. thats good but when I Start debugging I get the following error
"No mapping exists from object type System.Windows.Forms.TextBox to a known managed provider native type."
from the  line:

Submit_btn.ExecuteNonQuery();

Not really sure what is causing this.  Here is the code for the button


private void Submit_btn_Click(object sender, EventArgs e)
        {
            myconnection.Open();

            SqlCommand Submit_btn = new SqlCommand("mp_submit", myconnection);
            Submit_btn.CommandType = CommandType.StoredProcedure;

            //Submit_btn.Parameters.AddWithValue("@Description", Desc_cb);
            Submit_btn.Parameters.AddWithValue("@Call", Call_box);

            Submit_btn.ExecuteNonQuery();
            myconnection.Close();
        }

I even commented out a line and rewrote the stored procedure and created a new table just to see if I could insert anything.

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0

    You can only add primitive types (or types that can be converted to primitive types) to the Parameters, it looks like you're adding the control itself (Call_box).  Try Call_box.Text or whatever property is appropriate for what you're doing.

    0
  • 0

    Thanks!!!

    That was it.. I went back and looked at my sample code and I just went right over that when i was coding that button.

    Thanks Again!!!!

    0