Hi everyone, i'am trying read the data from a table MS acces in a webforms ASP with visual basic 2010, but this show the following error. someone you maybe helpme.
Error Message "Data type mismatch in criteria expression."
here's the code:
Protected Sub btnbuscar1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnbuscar1.Click
Try
Dim con As String = Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\luis.valdez\Documents\info.accdb
conConexion = New OleDb.OleDbConnection(con)
Catch ex As Exception
MsgBox("Error al conectarse")
End Try
Dim lista As Byte
Dim str As String
If txtIdcaso.Text Then
conConexion.Open()
str = SELECT * FROM Casos_Tbl WHERE (IDCaso = '" & txtIdcaso.Text & "')"
'Dim cmd As OleDbCommand = New OleDbCommand(str, conConexion)
adaptador = New OleDb.OleDbDataAdapter(str, conConexion)
registro = New DataSet
adaptador.Fill(registro, "Casos_Tbl")
lista = registro.Tables("Casos_Tbl").Rows.Count
Else
MsgBox("Debe Ingresar un codigo.", vbExclamation, "UTCtickets")
End If
If lista = 0 Then
lblidcase.Text = registro.Tables("Casos_Tbl").Rows(0).Item("IDCaso")
txtuser.Text = registro.Tables("Casos_Tbl").Rows(0).Item("Usuario")
txtarea.Text = registro.Tables("Casos_Tbl").Rows(0).Item("Area")
lblDate.Text = registro.Tables("Casos_Tbl").Rows(0).Item("FechayHora")
Dropcateg.Text = registro.Tables("Casos_Tbl").Rows(0).Item("Categoria")
LblSev1.Text = registro.Tables("Casos_Tbl").Rows(0).Item("Severidad")
dropstat.Text = registro.Tables("Casos_Tbl").Rows(0).Item("Status")
txtdescort.Text = registro.Tables("Casos_Tbl").Rows(0).Item("DescripcionCorta")
txtdescdetall.Text = registro.Tables("Casos_Tbl").Rows(0).Item("DescripcionDetallada")
End If
txtIdcaso.Focus()
End Sub