473,720 Members | 2,687 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

System.Data.Ole Db.OleDbExcepti on: Data type mismatch in criteria expression.

Please, can someone help me out to solve this error, i've been
searching throughout my codes and yet i didnt succeed in finding the
error!!!!

The Error is:

Server Error in '/' Application.
--------------------------------------------------------------------------------

Data type mismatch in criteria expression.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.Data.Ole Db.OleDbExcepti on: Data type
mismatch in criteria expression.

Source Error:
Line 19:
Line 20: oDA = New OleDbDataAdapte r(sSql, oConn)
Line 21: oDA.Fill(oDS, "product")
Line 22: txtProduct_Numb er.Text =
oDS.Tables("pro duct").Rows(0). Item("Product_N umber")
Line 23: txtProduct_Type .Text =
oDS.Tables("pro duct").Rows(0). Item("Product_T ype")
Source File: c:\inetpub\wwwr oot\bhavish\pro ducts_update.as px Line:
21

Here is my codes:
_______________ _______________ _______________ _______________ _______________ ____

<%@ Page Language="VB" debug="true"%>
<%@ Import Namespace="Syst em.Data" %>
<%@ Import Namespace="Syst em.Data.OleDb"% >
<script language="VB" runat=server>
Dim oConn As New OleDbConnection ("Provider=Micr osoft.Jet.OLEDB .
4.0;Data Source=C:\bhavi sh_vb_asign\Sto resDbs.mdb")
Dim strProduct_Numb er, strProduct_Type , strProduct,
strProduct_Deta ils, strPrice, strPhoto as string

Sub Insert_Click(By Val Src As Object, ByVal E As EventArgs)
Dim oDA As OleDbDataAdapte r
Dim oDS As New DataSet
Dim sSql As String
oConn.Open()
sSql = "UPDATE product SET Product_Type = '" &
txtProduct_Type .text & "', Product = '" & txtproduct.text & "',
Product_Details = '" & txtProduct_Deta ils.text & "', Price = '" &
txtPrice.text & "', Photo = '" & txtPhoto.text & "' WHERE
Product_Number = '" & txtProduct_Numb er.Text & "' "
oDA = New OleDbDataAdapte r(sSql, oConn)
oDA.Fill(oDS, "product")
txtProduct_Numb er.Text =
oDS.Tables("pro duct").Rows(0). Item("Product_N umber")
txtProduct_Type .Text =
oDS.Tables("pro duct").Rows(0). Item("Product_T ype")
txtProduct.Text =
oDS.Tables("pro duct").Rows(0). Item("Product")
txtProduct_Deta ils.Text =
oDS.Tables("pro duct").Rows(0). Item("Product_D etails")
txtPrice.Text = oDS.Tables("pro duct").Rows(0). Item("Price")
txtPhoto.Text = oDS.Tables("pro duct").Rows(0). Item("Photo")
End Sub

Private Function update(ByVal oConn As OleDbConnection , ByVal
strInsertSQL As String) As Integer
Dim intQueryState As Integer
' Connect to Database
oConn.Open()
'Make the OleDbCommand object
Dim cmdInsert As New OleDbCommand(st rInsertSQL, oConn)
intQueryState = cmdInsert.Execu teNonQuery()
oConn.Close()
Return intQueryState
End Function

Private Function Exists(ByVal oConn As OleDbConnection , ByVal
Value As String, ByVal ValueColumn As String, ByVal Item As String,
ByVal ItemColumn As String, ByVal TableName As String, Optional ByVal
bIsNumeric As Boolean = False) As Integer
Dim blnUserAuthenti cated As Boolean = False
' Connect to Database
Dim strSQL As String = "Select * from " & TableName & "
where " & ItemColumn & "='" & Item & "' AND " & ValueColumn & "=" &
IIf(bIsNumeric, Value, "'" & Value & "'")
Dim cmd As New OleDbCommand(st rSQL, oConn)
Dim objDataReader As OleDbDataReader
objDataReader = cmd.ExecuteRead er()
oConn.Close()

End Function
</script>

_______________ _______________ _______________ _______________ _______________ ____

Apr 10 '07 #1
2 8999
On Apr 10, 2:37 pm, "psychomad" <bhavish1...@gm ail.comwrote:
Please, can someone help me out to solve this error, i've been
searching throughout my codes and yet i didnt succeed in finding the
error!!!!

The Error is:

Server Error in '/' Application.
---------------------------------------------------------------------------*-----

Data type mismatch in criteria expression.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.Data.Ole Db.OleDbExcepti on: Data type
mismatch in criteria expression.

Source Error:

Line 19:
Line 20: oDA = New OleDbDataAdapte r(sSql, oConn)
Line 21: oDA.Fill(oDS, "product")
Line 22: txtProduct_Numb er.Text =
oDS.Tables("pro duct").Rows(0). Item("Product_N umber")
Line 23: txtProduct_Type .Text =
oDS.Tables("pro duct").Rows(0). Item("Product_T ype")

Source File: c:\inetpub\wwwr oot\bhavish\pro ducts_update.as px Line:
21

Here is my codes:
_______________ _______________ _______________ _______________ _______________ *____

<%@ Page Language="VB" debug="true"%>
<%@ Import Namespace="Syst em.Data" %>
<%@ Import Namespace="Syst em.Data.OleDb"% >

<script language="VB" runat=server>
Dim oConn As New OleDbConnection ("Provider=Micr osoft.Jet.OLEDB .
4.0;Data Source=C:\bhavi sh_vb_asign\Sto resDbs.mdb")
Dim strProduct_Numb er, strProduct_Type , strProduct,
strProduct_Deta ils, strPrice, strPhoto as string

Sub Insert_Click(By Val Src As Object, ByVal E As EventArgs)
Dim oDA As OleDbDataAdapte r
Dim oDS As New DataSet
Dim sSql As String
oConn.Open()
sSql = "UPDATE product SET Product_Type = '" &
txtProduct_Type .text & "', Product = '" & txtproduct.text & "',
Product_Details = '" & txtProduct_Deta ils.text & "', Price = '" &
txtPrice.text & "', Photo = '" & txtPhoto.text & "' WHERE
Product_Number = '" & txtProduct_Numb er.Text & "' "

oDA = New OleDbDataAdapte r(sSql, oConn)
oDA.Fill(oDS, "product")
txtProduct_Numb er.Text =
oDS.Tables("pro duct").Rows(0). Item("Product_N umber")
txtProduct_Type .Text =
oDS.Tables("pro duct").Rows(0). Item("Product_T ype")
txtProduct.Text =
oDS.Tables("pro duct").Rows(0). Item("Product")
txtProduct_Deta ils.Text =
oDS.Tables("pro duct").Rows(0). Item("Product_D etails")
txtPrice.Text = oDS.Tables("pro duct").Rows(0). Item("Price")
txtPhoto.Text = oDS.Tables("pro duct").Rows(0). Item("Photo")

End Sub

Private Function update(ByVal oConn As OleDbConnection , ByVal
strInsertSQL As String) As Integer
Dim intQueryState As Integer
' Connect to Database
oConn.Open()
'Make the OleDbCommand object
Dim cmdInsert As New OleDbCommand(st rInsertSQL, oConn)
intQueryState = cmdInsert.Execu teNonQuery()
oConn.Close()
Return intQueryState
End Function

Private Function Exists(ByVal oConn As OleDbConnection , ByVal
Value As String, ByVal ValueColumn As String, ByVal Item As String,
ByVal ItemColumn As String, ByVal TableName As String, Optional ByVal
bIsNumeric As Boolean = False) As Integer
Dim blnUserAuthenti cated As Boolean = False
' Connect to Database
Dim strSQL As String = "Select * from " & TableName & "
where " & ItemColumn & "='" & Item & "' AND " & ValueColumn & "=" &
IIf(bIsNumeric, Value, "'" & Value & "'")
Dim cmd As New OleDbCommand(st rSQL, oConn)
Dim objDataReader As OleDbDataReader
objDataReader = cmd.ExecuteRead er()
oConn.Close()

End Function
</script>

_______________ _______________ _______________ _______________ _______________ *____

The Fill method retrieves the data from the data source using a SELECT
statement. You do an UPDATE, and no SELECT.

Apr 10 '07 #2
On Apr 10, 9:08 pm, "Alexey Smirnov" <alexey.smir... @gmail.comwrote :
On Apr 10, 2:37 pm, "psychomad" <bhavish1...@gm ail.comwrote:


Please, can someone help me out to solve this error, i've been
searching throughout my codes and yet i didnt succeed in finding the
error!!!!
The Error is:
Server Error in '/' Application.
---------------------------------------------------------------------------**-----
Data type mismatch in criteria expression.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.Data.Ole Db.OleDbExcepti on: Data type
mismatch in criteria expression.
Source Error:
Line 19:
Line 20: oDA = New OleDbDataAdapte r(sSql, oConn)
Line 21: oDA.Fill(oDS, "product")
Line 22: txtProduct_Numb er.Text =
oDS.Tables("pro duct").Rows(0). Item("Product_N umber")
Line 23: txtProduct_Type .Text =
oDS.Tables("pro duct").Rows(0). Item("Product_T ype")
Source File: c:\inetpub\wwwr oot\bhavish\pro ducts_update.as px Line:
21
Here is my codes:
_______________ _______________ _______________ _______________ _______________ **____
<%@ Page Language="VB" debug="true"%>
<%@ Import Namespace="Syst em.Data" %>
<%@ Import Namespace="Syst em.Data.OleDb"% >
<script language="VB" runat=server>
Dim oConn As New OleDbConnection ("Provider=Micr osoft.Jet.OLEDB .
4.0;Data Source=C:\bhavi sh_vb_asign\Sto resDbs.mdb")
Dim strProduct_Numb er, strProduct_Type , strProduct,
strProduct_Deta ils, strPrice, strPhoto as string
Sub Insert_Click(By Val Src As Object, ByVal E As EventArgs)
Dim oDA As OleDbDataAdapte r
Dim oDS As New DataSet
Dim sSql As String
oConn.Open()
sSql = "UPDATE product SET Product_Type = '" &
txtProduct_Type .text & "', Product = '" & txtproduct.text & "',
Product_Details = '" & txtProduct_Deta ils.text & "', Price = '" &
txtPrice.text & "', Photo = '" & txtPhoto.text & "' WHERE
Product_Number = '" & txtProduct_Numb er.Text & "' "
oDA = New OleDbDataAdapte r(sSql, oConn)
oDA.Fill(oDS, "product")
txtProduct_Numb er.Text =
oDS.Tables("pro duct").Rows(0). Item("Product_N umber")
txtProduct_Type .Text =
oDS.Tables("pro duct").Rows(0). Item("Product_T ype")
txtProduct.Text =
oDS.Tables("pro duct").Rows(0). Item("Product")
txtProduct_Deta ils.Text =
oDS.Tables("pro duct").Rows(0). Item("Product_D etails")
txtPrice.Text = oDS.Tables("pro duct").Rows(0). .Item("Price")
txtPhoto.Text = oDS.Tables("pro duct").Rows(0). .Item("Photo")
End Sub
Private Function update(ByVal oConn As OleDbConnection , ByVal
strInsertSQL As String) As Integer
Dim intQueryState As Integer
' Connect to Database
oConn.Open()
'Make the OleDbCommand object
Dim cmdInsert As New OleDbCommand(st rInsertSQL,oCon n)
intQueryState = cmdInsert.Execu teNonQuery()
oConn.Close()
Return intQueryState
End Function
Private Function Exists(ByVal oConn As OleDbConnection , ByVal
Value As String, ByVal ValueColumn As String, ByVal Item As String,
ByVal ItemColumn As String, ByVal TableName As String, Optional ByVal
bIsNumeric As Boolean = False) As Integer
Dim blnUserAuthenti cated As Boolean = False
' Connect to Database
Dim strSQL As String = "Select * from " & TableName & "
where " & ItemColumn & "='" & Item & "' AND " & ValueColumn & "=" &
IIf(bIsNumeric, Value, "'" & Value & "'")
Dim cmd As New OleDbCommand(st rSQL, oConn)
Dim objDataReader As OleDbDataReader
objDataReader = cmd.ExecuteRead er()
oConn.Close()
End Function
</script>
_______________ _______________ _______________ _______________ _______________ **____

The Fill method retrieves the data from the data source using a SELECT
statement. You do an UPDATE, and no SELECT.- Hide quoted text -

- Show quoted text -

And check the values you substitute in the query

sSql = "UPDATE product SET Product_Type = '" &
txtProduct_Type .text & "', Product = '" & txtproduct.text & "',
Product_Details = '" & txtProduct_Deta ils.text & "', Price = '" &
txtPrice.text & "', Photo = '" & txtPhoto.text & "' WHERE
Product_Number = '" & txtProduct_Numb er.Text & "' "

Apr 10 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
5286
by: silesius | last post by:
I've been using VS 2003 to develop a webapplication using C#. Today I exported the application to a remote webserver I begun experiencing problems. It's a simple application that retrieves some information from an Access database. It worked fine when I ran on my computer. I use a parameterized query to retrieve some customer specific information. Customer logs in, I store the username they log in with in the session state and on the...
1
6891
by: T8 | last post by:
I have a asp.net (framework 1.1) site interfacing against SQL 2000. It runs like a charm 99% of the time but once in a while I get the following "unspecified error". Sometimes it would resolve by itself (asp.net recycled?); it also can be solved by restarting IIS. Any ideas what cause(s) this to happen? System.Data.OleDb.OleDbException: Unspecified error at System.Data.OleDb.OleDbDataReader.ProcessResults(Int32 hr) at...
0
2777
by: silesius | last post by:
I've been using VS.NET 2003 to develop a webapplication using C#. Today I exported the application to another webserver I begun experiencing problems. It's a simple application that retrieves some information from an Access database. It worked fine when I ran on my home computer. I use a datagrid witha a dataset and a parameterized query to retrieve some customer specific information. Customer logs in, I store the username they log in...
3
8832
by: Brian Foree | last post by:
I am developing an ASP.NET application that uses Access 2000 as its backend, and have just started getting the following error on 2 ASP.NET pages that had been working until late last week (and I don't think I made any changes to either page other than changing the user control that creates the header). Server Error in '/myApp' Application. ---------------------------------------------------------------------------- ----
0
5665
by: NicK chlam via DotNetMonster.com | last post by:
this is the error i get System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement. at System.Data.Common.DbDataAdapter.Update(DataRow dataRows, DataTableMapping tableMapping) at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable) at System.Data.Common.DbDataAdapter.Update(DataSet dataSet) at TryThis.Form1.save() in C:\Documents and Settings\Nick\My Documents\...
5
9649
by: petro | last post by:
Hello all, My asp.net web application works on my machine but I get the following error on our test web server, There is only one oracle home on the test server. Does anyone know how to resolve this error? Oracle error occurred, but error message could not be retrieved from Oracle. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the...
0
2949
by: dim mzeura via .NET 247 | last post by:
(Type your message here) -------------------------------- From: dim mzeura I have the same problem too. Please help! System.Data.OleDb.OleDbException: Syntax error (missing operator) in query expression ''\\crwfs1\projects12\AP-Wilbur\Analysis_NonQuantitative\Damages_Report\Backup_Exhibits_Leitzinger's_Damages_Calculations', '328424' )'. -----Here is my code----
1
2714
by: DC | last post by:
Any idea why this code would cause a error? The SQL that gets executed seems to be (using record 1132 as an example) DELETE FROM user_table WHERE ID = '1132'; And the value of ViewState("ID") =1132 ID is an Access database autonumber field. Is Viewstate data passed as an odd type or something?
0
1499
by: chanlichin | last post by:
Select Case (cbMonth.Text) Case "January" Dates = "1" Case "February" Dates = "2" Case "March"
0
9365
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9212
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9127
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
9056
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8002
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
6664
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
5973
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
4483
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2127
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.