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

    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.+

    <html>
    <head>
    <title>Bavant Marine Services: Technician Master List</title>
    <style>
    td.title{background-color=skyblue}
    </style>
    <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
    -->
    </script>
    </head>
    <body>
    <%
    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")
    conn.open "BMS"
    set techno=conn.execute(sql)
    %>
    <form value=frmDB>
    <table cellspacing=2 cellpadding=0 bordercolor=black border=0>
    <tr>
    <td class=title>Tech Number:<td><input type=text name=txtTechNumber value=<%= techno(0)%> size=2>
    <tr>
    <td class=title>Last Name:<td><input type=text name=txtLastN value=<%= techno(1)%>>
    <tr>
    <td class=title>First Name:<td><input type=text name=txtFirstN value=<%= techno(2)%>>
    <tr>
    <td class=title>Address:<td><input type=text name=txtAddress value=<%= techno(3)%>>
    <tr>
    <td class=title>City:<td><input type=text name=txtCity value=<%= techno(4)%>>
    <tr>
    <td class=title>State:<td><input type=text name=txtState value=<%= techno(5)%>>
    <tr>
    <td class=title>Zip:<td><input type=text name=txtZip value=<%= techno(6)%>>
    <tr>
    <td class=title>Hourly Rate:<td><input type=text name=txtRate value=<%= techno(7)%>>
    <tr>
    <td class=title>YTD Earnings:<td><input type=text name=txtYTD value=<%= techno(8)%>>
    <tr>
    <td class=title>Start Date:<td><input type=text name=txtStart value=<%= techno(9)%>>
    <tr>
    <td class=title>Specialities:<td><textarea rows=8 name=txtSpecialties><%= techno(10)%></textarea>
    <tr>
    <td><input type=button name=cmdSave value="Save">

    </form>
    </body>
    </html>

  2. #2
    Join Date
    Jan 2003
    Location
    Midwest
    Posts
    138
    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
    Posts
    4

    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
    Posts
    4

    Another thing

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

  5. #5
    Join Date
    Feb 2003
    Posts
    6

    Re: Data type mismatch in criteria expression.

    Modify the sql statment as ----

    Technician.TechNumber='36'

    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
    Posts
    4

    Tricky

    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
  •