473,769 Members | 5,742 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

datatype mismatch error

28 New Member
I m havin an error of datatype mismatch
actual here i m askin user to input the code in text box and then searchin the
record havin that code in database
the problem is the code field Bnum is of number datatype
so its showin me this error
Microsoft JET Database Engine (0x80040E07)
Data type mismatch in criteria expression.
/library/12updbook1.asp, line 128



<%


bc=request.form ("txtbc")
response.Cookie s("bn")=bc

set con=server.Crea teObject("ADODB .connection")
con.open "File Name=C:\Inetpub \wwwroot\librar y\mylink.udl"


set rsa=server.Crea teObject("ADODB .recordset")
rsa.open "select * from Book where Bnum='"&bc&"'", con

if rsa.eof then response.Redire ct("12updbook3. asp")


%>
Mar 3 '08 #1
2 1559
DrBunchman
979 Recognized Expert Contributor
Hi chirag,

Does it work if you put an integer into the input? Are you validating the input field at all?

Dr B
Mar 3 '08 #2
chirag1989
28 New Member
Hi chirag,

Does it work if you put an integer into the input? Are you validating the input field at all?

Dr B
no,its not workin
but i got the solution
it was just the matter of qoutes

<%


bc=request.form ("txtbc")
response.Cookie s("bn")=bc

set con=server.Crea teObject("ADODB .connection")
con.open "File Name=C:\Inetpub \wwwroot\librar y\mylink.udl"


set rsa=server.Crea teObject("ADODB .recordset")
rsa.open "select * from Book where Bnum="&bc&" ",con

'before it was ' " &bc& " '

if rsa.eof then response.Redire ct("12updbook3. asp")


%>
Mar 4 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2927
by: Stephen Briley | last post by:
For some reason, my posts are scrubbed as attachments. Lets hope that sending from the yahoo account works. I'm new to Python and I'm trying to do some database work with MS Access, but I can't seem to get around a "datatype mismatch error". Here's an example table that I'm working with... ID name dept 1 steve acct
2
2124
by: Steve Briley | last post by:
I'm new to Python and I'm trying to do some database work with MS Access, but I can't seem to get around a "datatype mismatch error".&nbsp; Here's an example table that I'm working with... &nbsp; ID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name&nbsp;&nbsp;&nbsp; dept 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; steve&nbsp;&nbsp; acct
1
2957
by: Sam Gledhill | last post by:
I hope somebody can help me, I have a problem executing this line of sql: Dim rstur As New Recordset Dim sql As String sql = "SELECT * FROM tblpat WHERE ='" & Me! & "'" Set rstur = CurrentDb.OpenRecordset(sql)
1
2487
by: Ken | last post by:
I wrote a function to use in queries that takes a date and adds or subtracts a certain length time and then returns the new value. There are times when my function needs to return Null values. Function DateCalc (blah...) As Variant Do Stuff... If Not IsNull(varNewDate) Then DateCalc = varNewDate End If End Function
2
13533
by: JingleBEV | last post by:
Hi, Iam coding data access application with database object and recordset. Here' s my code '------------------------------------------------------------------ Private Function CreateRecordSet() As Boolean Dim db As Database Dim rs As Recordset Set db = DBEngine.Workspaces(0).OpenDatabase(txtDBpath) sql = "SELECT * FROM TblMembers"
6
3395
by: rn5a | last post by:
I am inserting records in a MS-Access database table. The data type of one of the columns named *OrderDate* in the DB table is Date/Time. This is the SQL query I am using to insert the records in the Access DB table: =============================== strSQL = "INSERT INTO Cart (CartID, ProductID, Quantity, Total, OrderDate) VALUES (CID, PID, Qty, TotalAmt, ODate)" oleDbCmd = New OleDbCommand(strSQL, oleDbConn)
0
1233
by: Snoopy33 | last post by:
I have a query that builds a date from a text field with the date imput as yyyymmdd in the query, so i have to piece it together in my expression as follows: exp: FormatNumber(DateDiff("d",DateSerial(Left(, 4),Left(Right(,4),2),Right(,2)),Now()))) if i don't use a criteria, it works fine. when i try to use the criteria <7 is when i get the error. It will show the correct records
9
2225
by: rscheinberg | last post by:
I am working in Access 2007 attempting to grab 2 characters from a text field named ProjectNumber. After determining what 2 digits to add in front to make it a year, I need to do that. I have done that in the code below to create a value for "intPN". I then need that value to become a number so that I can compare it to a range of years (1983-1987). The code below returns the 4 character year as intended. But I get a Datatype mismatch error...
14
1890
by: rscheinberg | last post by:
I am working in Access 2007 attempting to grab 2 characters from a text field named ProjectNumber. After determining what 2 digits to add in front to make it a year, I need to do that. I have done that in the code below to create a value for "intPN". I then need that value to become a number so that I can compare it to a range of years (1983-1987). The code below returns the 4 character year as intended. But I get a Datatype mismatch in criteria...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9990
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8869
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7406
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3956
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.