Data type mismatch in criteria expression
Below is my code for an edit form page that I am working on:
-----------------
Imports System.Data
Imports System.Data.OleDb
Imports System.Web
Public Class EditUserAccount
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'see if user is logged in
If Session("IsLoggedIn") = False Then
Response.Redirect("frmLogin2.aspx")
End If
'Dim variables and objects
Dim objUser As New clsUser()
Dim objDBComm As OleDbCommand
Dim objDBConn As OleDbConnection
Dim intID As Int16
Dim strName, strAddress As String
Dim strSQL As String
'setup database connection
Dim objGetConnection As New clsDBConnection()
objDBConn = objGetConnection.GetDatabaseConnection
'setup SQL string
strSQL = "SELECT UserID, Name, Address, City, Province, PostalCode, Username, [Password] FROM [User] WHERE UserID = '2'"
Dim objDR As OleDbDataReader
Dim Cmd As New OleDbCommand(strSQL, objDBConn)
objDR = Cmd.ExecuteReader(System.Data.CommandBehavior.Clos eConnection) While objDR.Read()
intID = objDR("UserID")
strName = objDR("Name")
strAddress = objDR("Address")
End While
Page.DataBind()
'load form textboxes with selected data from database
Request.Form("txtname") = strName
Request.Form("txtaddress") = strAddress
End Sub
End Class
------------------------
I get the following error on the above red line:
----
Data type mismatch in criteria expression
----
Anyone know the casue &/or solution.
Thanks,
Mark
|