I have created an ASP.net web page. I cannot figure out why I am getting the following error:
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.OleDb.OleDbException: Data type mismatch in criteria expression.
Source Error:
Line 56:
Line 57: 'Execute the SQL statement -- using the command object -- to populate the DataReader
Line 58: dtrPictures = objCommand.ExecuteReader()
Line 59:
Line 60: 'Read the record into the DataReader object |
Here's a copy of my code:
<%@ Page Language="VB" Debug="True" Trace="True" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.OleDb" %>
<script runat="server">
'=========================================================
' procedures:
' DisplayRecord(strPicID as String)
' Page_Load()
'=========================================================== ==
'Make this DataReader object module-level in scope so that we
'can bind directly to its field values
dim dtrPictures As OleDbDataReader
'---------------------------------------------
' name: DisplayRecord(strPicID as String)
'---------------------------------------------
Sub DisplayRecord(strPicID as String)
Dim strConnect As String
Dim objConnect As New OleDbConnection()
Dim strSQL as String
Dim objCommand As New OleDbCommand()
Dim databaseName, path
databaseName = "----.mdb"
path = Server.MapPath(".")
path = Replace(path,"html","database")
'Create Connection object
strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data " _
& "Source=" & path & "\" & databaseName