Data Type Mismatch

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Aruna Dalvi
    New Member
    • Mar 2011
    • 3

    Data Type Mismatch

    Hi friend
    Please tell me why this error is occured in following code

    error=ERROR [22018] [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.




    Code:
    cmd = New OdbcCommand("INSERT INTO TableHR1 (No,name_of_candidate,Address,Date_of_birth,PhoneN o,Email, _
    Design_Eng,CAE_Eng,Mkt,Accounting,It,Admin ,Experience,Industry,Current_CTC,InHand,ExpectedCT C, _
    Exp_Inhand,Joining_Period,Iziel_Result,Iziel_Rem ark,Candidate_Remark) " _
    & " VALUES ( '" + notxt.Text + "', '" + nametxt.Text + " ','" + Addresstxt.Text + _
    " ',' " + DateOfBirthtxt.Text + "','" + Phonetxt.Text + "',' " _
     + Emailtxt.Text + " ','" + TextBox2.Text + "','" + TextBox3.Text _
    + "',' " + TextBox7.Text + "','" + TextBox4.Text + "','" + TextBox8.Text _
     + "','" + TextBox5.Text + "',' " + TextBox1.Text + "','" + TextBox6.Text _
    + "','" + CurrentCTCtxt.Text + "' ,'" + Inhandtxt.Text + "', '" + ExpectedCTCtxt.Text _
    + " ', '" + Expectedinhand.Text + "' ,' " + joiningtxt.Text + " ', '" _
    + iZielResultktxt.Text + " ','" + IzielRemarktxt.Text + "','" + CandidateResulttxt.Text + "')", con)
    Last edited by Stewart Ross; Mar 12 '11, 12:57 PM. Reason: Retitled + code tagged + tidied code
  • Stewart Ross
    Recognized Expert Moderator Specialist
    • Feb 2008
    • 2545

    #2
    You are treating every field as being text - each VALUE in your insert statement is being enclosed in single quotes. One or more of these fields is not of type text in the underlying table. You will need to find out which yourself, as you give no clues to us in your question other than in names of fields such as date_of_birth, which would not normally be a text field.

    -Stewart

    Comment

    Working...