Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2003

    Unanswered: Data type mismatch in criteria expression.

    I'm new to ASP and Im trying to make a small DB editing page... I keep getting the Data type mismatch in criteria expression. error whenever I add a where expression in my SQL statment.+

    <title>Bavant Marine Services: Technician Master List</title>
    <script language=Vbscript>
    Function fnUpdateFrm()
    document.frmDB.txtTechnumber.value=Response.write( techno(0))
    document.frmDB.txtFirstN.value=Response.write(tech no(1))
    document.frmDB.txtLastN.value=Response.write(techn o(2))
    end function
    sql="SELECT Technician.TechNumber, Technician.LastN, Technician.FirstN, Technician.Address, Technician.City, "&_
    "Technician.State, Technician.Zip, Technician.HourlyRate, Technician.YTD, Technician.StartDate, Technician.Specialities, "&_
    "Technician.Picture, Technician.WebPage FROM Technician WHERE Technician.TechNumber=36"
    set conn = Server.CreateObject("ADODB.Connection") "BMS"
    set techno=conn.execute(sql)
    <form value=frmDB>
    <table cellspacing=2 cellpadding=0 bordercolor=black border=0>
    <td class=title>Tech Number:<td><input type=text name=txtTechNumber value=<%= techno(0)%> size=2>
    <td class=title>Last Name:<td><input type=text name=txtLastN value=<%= techno(1)%>>
    <td class=title>First Name:<td><input type=text name=txtFirstN value=<%= techno(2)%>>
    <td class=title>Address:<td><input type=text name=txtAddress value=<%= techno(3)%>>
    <td class=title>City:<td><input type=text name=txtCity value=<%= techno(4)%>>
    <td class=title>State:<td><input type=text name=txtState value=<%= techno(5)%>>
    <td class=title>Zip:<td><input type=text name=txtZip value=<%= techno(6)%>>
    <td class=title>Hourly Rate:<td><input type=text name=txtRate value=<%= techno(7)%>>
    <td class=title>YTD Earnings:<td><input type=text name=txtYTD value=<%= techno(8)%>>
    <td class=title>Start Date:<td><input type=text name=txtStart value=<%= techno(9)%>>
    <td class=title>Specialities:<td><textarea rows=8 name=txtSpecialties><%= techno(10)%></textarea>
    <td><input type=button name=cmdSave value="Save">


  2. #2
    Join Date
    Jan 2003
    Why not just say
    SELECT * FROM Technician WHERE techNumber = 36

    Check to see if the datatype of the technumber is an integer or a string.

    if string then
    SELECT * FROM Technician WHERE techNumber = '36'

  3. #3
    Join Date
    Feb 2003

    Talking Thanks

    Man, that was freiking anoying! I couldnt figure out for the life of me why that wasnt working. If I use SELECT * will it still create an array?

  4. #4
    Join Date
    Feb 2003

    Another thing

    How would I put a Request.QueryString function in my statement as a string?

  5. #5
    Join Date
    Feb 2003

    Re: Data type mismatch in criteria expression.

    Modify the sql statment as ----


    In real life you will not hard coding the where clause .. so it should look like this

    where Technician.TechNumber=' " & tecNum & " ' "

    I hope it helps else send me a detailed error message.

    Happy Coding. :-)

    Kiran Math

  6. #6
    Join Date
    Feb 2003


    Wow, thats tricky, I didnt use that, I just converted the database column into a number insted

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts