Visual Basic - OleDBException... Data Type mismatch in criteria expression ... Visual studio 2010

Life is soft - evento anual de software empresarial
   
Vista:

OleDBException... Data Type mismatch in criteria expression ... Visual studio 2010

Publicado por Miguel macv012877@hotmail.com (1 intervención) el 15/04/2012 00:17:11
Hola que tal, mi nombre es Miguel y estoy iniciando en la programacion de Visual Studio 2010, estoy haciendo este programa para buscar sustituciones de diferentes articulos, pero estoy detenido porque cuando quiero buscar las opciones a traves de la seleccion de los radio buttons, Visual me muestra el siguiente error...

OleDBException was unhandled by user code... Data Type mismatch in criteria expression



de antemano gracias por su tiempo y su ayuda...


Imports System.Data
Imports System.Data.OleDb
Public Class Form1
Dim dbconexion As OleDbConnection
Dim cdbommand As OleDbCommand
Dim DA As OleDbDataAdapter
Dim DA2 As OleDbDataAdapter
' Dim ConnectionString As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source= C:\Users\mcarvajal\Documents\dbCompras.mdb")
Dim ConnectionString As New OleDb.OleDbConnection("Provider=Microsoft.ace.OLEDB.12.0;Data Source= C:\Users\mcarvajal\Documents\dbCompras.mdb")
Dim DS As DataSet
Dim DS2 As DataSet
Dim DT2 As DataTable
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub

' esta parte funciona perfectamente
Private Sub cmbfind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbfind.Click
'busca las especificaciones del articulo /find the specs of item
ConnectionString.Open()
Dim DS As New DataSet
Dim DA As New OleDb.OleDbDataAdapter("SELECT* FROM TBveneer WHERE Itemnum='" & txbitem.Text & "'", ConnectionString)
DA.Fill(DS)
txbitem.Text = DS.Tables(0).Rows(0)("Itemnum").ToString
txbdesc.Text = DS.Tables(0).Rows(0)("Description").ToString
TxbWmm.Text = DS.Tables(0).Rows(0)("Wmm").ToString
TxbLmm.Text = DS.Tables(0).Rows(0)("Lmm").ToString
TextBox1.Text = DS.Tables(0).Rows(0)("Grade").ToString
TextBox2.Text = DS.Tables(0).Rows(0)("Specie").ToString
'Dim grade, specie As String
'grade = DS.Tables(0).Rows(0)("Grade").ToString
'specie = DS.Tables(0).Rows(0)("Specie").ToString
ConnectionString.Close()
DS.Dispose()
DA.Dispose()
End Sub
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged

'paso para filtrar
'busca opciones que puedo utilizar cuando no tengo disponible el articulo/find options we can use when we don't have stock of item
ConnectionString.Open()
Dim DS As New DataSet
Dim DA As New OleDb.OleDbDataAdapter(("SELECT* FROM TBveneer WHERE Wmm >='" & TxbWmm.Text & "' AND Lmm >='" & TxbLmm.Text & "'AND Grade ='" & TextBox1.Text & "'AND Specie ='" & TextBox2.Text & "' "), ConnectionString)


DA.Fill(DS) ' aqui es donde me muestra este error
' OleDBException was unhandled by user code... Data Type mismatch in criteria expression

DGVveneer.DataSource = DS.Tables(0)
DGVveneer.Visible = True
DGVveneer.DefaultCellStyle.BackColor = Color.Silver
DGVveneer.AlternatingRowsDefaultCellStyle.BackColor = Color.AntiqueWhite
DS.Dispose()
DA.Dispose()
ConnectionString.Close()
End Sub

Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
'paso para filtrar
'busca opciones en donde sustituir el articulo cuando tengo exceso/find options where to substitute the item when have excess material

'paso para filtrar
ConnectionString.Open()
Dim DS As New DataSet
Dim DA As New OleDb.OleDbDataAdapter(("SELECT* FROM TBveneer WHERE Wmm <='" & TxbWmm.Text & "' AND Lmm <='" & TxbLmm.Text & "'AND Grade ='" & TextBox1.Text & "'AND Specie ='" & TextBox2.Text & "' "), ConnectionString)

DA.Fill(DS) ' aqui es donde me muestra este error
' OleDBException was unhandled by user code... Data Type mismatch in criteria expression
DGVveneer.DataSource = DS.Tables(0)
DGVveneer.Visible = True
DGVveneer.DefaultCellStyle.BackColor = Color.Silver
DGVveneer.AlternatingRowsDefaultCellStyle.BackColor = Color.AntiqueWhite
DS.Dispose()
DA.Dispose()
ConnectionString.Close()

End Sub


Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged
'paso para filtrar
'busca opciones en donde sustituir el articulo por medidas especie y grado/find options where to substitute the item by sizes, specie and grade
'paso para filtrar
Dim Gr, Sp As String
Gr = TextBox1.Text
Sp = TextBox2.Text

ConnectionString.Open()
Dim DS As New DataSet

Dim DA As New OleDb.OleDbDataAdapter(("SELECT* FROM TBveneer WHERE Wmm <='" & TxbWmm.Text & "' AND Lmm <='" & TxbLmm.Text & "'AND Grade ='" & Gr & "'AND Specie ='" & Sp & "' "), ConnectionString)

DA.Fill(DS) ' aqui es donde me muestra este error
' OleDBException was unhandled by user code... Data Type mismatch in criteria expression
DGVveneer.DataSource = DS.Tables(0)
DGVveneer.Visible = True
DGVveneer.DefaultCellStyle.BackColor = Color.Silver
DGVveneer.AlternatingRowsDefaultCellStyle.BackColor = Color.AntiqueWhite
DS.Dispose()
DA.Dispose()
ConnectionString.Close()

End Sub
End Class
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder