Error converting data type varchar to numeric.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mattjmacdonald
    New Member
    • Aug 2010
    • 2

    #1

    Error converting data type varchar to numeric.

    I am getting the error Error converting data type varchar to numeri when trying to save some of the information that is entered in a textbox to my sql server 2005 database. HEre is the code for my insert statement. Any help is appreciated.
    Thanks,

    Matt

    Code:
    'declare your variables
        Dim FirstName, LastName, Comments, MRN
        Dim sConnString, connection, sSQL
    'Receiving values from Form, assign the values entered to variables
        FirstName = Request.Form("FirstName")
        LastName = Request.Form("LastName")
        Comments = Request.Form("Comments")
        MRN = Request.Form("MRN")
    'declare SQL statement that will query the database 
        sSQL = "INSERT into tblPatientInfoTest (FirstName, LastName, Comments, MRN) values ('" & _
    FirstName & "', '" & LastName & "', '" & Comments & "', '" & MRN & "')"
  • MrMancunian
    Recognized Expert Contributor
    • Jul 2008
    • 569

    #2
    Are the fields in the database declared as varchar? You're inserting stringvalues (although not explicitly casted), so that should match your database types.

    Steven

    Comment

    Working...