Hi all, i am nw getting this data type mismatch error in testproduct.aspx. this is my code below
<code>
Private
Sub Page_Load(ByVal sender
As System.Object,
ByVal e As System.EventArgs)
Handles MyBase.Load
'Put user code to initialize the page here
If Not Page.IsPostBack
Then
Dim id As
String = Session("clicked")
Dim cnn As
New OleDbConnection _
("Provider=Microsoft.Jet.OLEDB.4.0; Data Source= " & Server.MapPath("speedy.mdb"))
Dim strSQL
As String = "SELECT * FROM Products WHERE product_id = '" + id + "' "
Dim cmd As
New OleDbCommand(strSQL, cnn)
Dim dr As OleDbDataReader
I'm getting the session frm pdtdesc2.aspx. The code is below
<code>
Private
Sub Page_Load(ByVal sender
As System.Object,
ByVal e As System.EventArgs)
Handles MyBase.Load
'Put user code to initialize the page here
Dim config1
As New IT2691.Configuration1
Dim strcon
As String = config1.get_connection()
Dim objDataReader
As OleDb.OleDbDataReader
Dim con As OleDbConnection
Dim cmd As
New OleDbCommand
Dim i As
Integer
'create a new connection
con =
New OleDbConnection(strcon)
'create sql statement
cmd.CommandText = ("Select * from Products where product_type = 'Anniversary'")
cmd.Connection = con
con.Open()
objDataReader = cmd.ExecuteReader()
'Bind the data to the data list control for display
dlpdtdesc.DataSource = objDataReader
dlpdtdesc.DataBind()
con.Close()
End Sub
Sub selected1(ByVal sender
As Object,
ByVal e As DataListCommandEventArgs)
Dim id As Label =
CType(e.Item.FindControl("productId"), Label)
Session("clicked") = id.Text
Response.Redirect("testproduct.aspx")
End Sub
End
Class <form id=Form1 method=post runat="server"></code></form>
NgSG
Member
85 Points
19 Posts
Data type mismatch in criteria expression
Aug 12, 2005 04:21 PM|LINK
<code>
Private
Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here If Not Page.IsPostBack Then Dim id As String = Session("clicked") Dim cnn As New OleDbConnection _("Provider=Microsoft.Jet.OLEDB.4.0; Data Source= " & Server.MapPath("speedy.mdb"))
Dim strSQL As String = "SELECT * FROM Products WHERE product_id = '" + id + "' " Dim cmd As New OleDbCommand(strSQL, cnn) Dim dr As OleDbDataReadercnn.Open()
dr = cmd.ExecuteReader()
If dr.Read Thenproductdesc.Text = dr("product_desc").ToString()
productid.Text = dr("product_id").ToString()
pdtimage.ImageUrl = dr("product_image").ToString()
End Ifcnn.Close()
End If End SubEnd
Class</code>
I'm getting the session frm pdtdesc2.aspx. The code is below
<code>
Private
Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here Dim config1 As New IT2691.Configuration1 Dim strcon As String = config1.get_connection() Dim objDataReader As OleDb.OleDbDataReader Dim con As OleDbConnection Dim cmd As New OleDbCommand Dim i As Integer 'create a new connectioncon =
New OleDbConnection(strcon) 'create sql statementcmd.CommandText = ("Select * from Products where product_type = 'Anniversary'")
cmd.Connection = con
con.Open()
objDataReader = cmd.ExecuteReader()
'Bind the data to the data list control for displaydlpdtdesc.DataSource = objDataReader
dlpdtdesc.DataBind()
con.Close()
End Sub Sub selected1(ByVal sender As Object, ByVal e As DataListCommandEventArgs) Dim id As Label = CType(e.Item.FindControl("productId"), Label)Session("clicked") = id.Text
Response.Redirect("testproduct.aspx")
End SubEnd
Class <form id=Form1 method=post runat="server"></code></form>