If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Data type mismatch in criteria expression.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-14-03, 02:30
Trent2800 Trent2800 is offline
Registered User
 
Join Date: Feb 2003
Posts: 4
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>
Reply With Quote
  #2 (permalink)  
Old 02-14-03, 14:13
Memnoch1207 Memnoch1207 is offline
Registered User
 
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'
Reply With Quote
  #3 (permalink)  
Old 02-14-03, 17:17
Trent2800 Trent2800 is offline
Registered User
 
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?
Reply With Quote
  #4 (permalink)  
Old 02-14-03, 17:23
Trent2800 Trent2800 is offline
Registered User
 
Join Date: Feb 2003
Posts: 4
Another thing

How would I put a Request.QueryString function in my statement as a string?
Reply With Quote
  #5 (permalink)  
Old 02-14-03, 17:27
kiranmath kiranmath is offline
Registered User
 
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
Reply With Quote
  #6 (permalink)  
Old 02-14-03, 17:38
Trent2800 Trent2800 is offline
Registered User
 
Join Date: Feb 2003
Posts: 4
Tricky

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

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On