Private Sub Search_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearchItem.Click Dim Dr As OleDbDataReader Dim Con As New OleDb.OleDbConnection("Provider=SQLOLEDB ;Data Source=Danawa;Initial Catalog=Store;Integrated Security=SSPI ") Con.Open() Dim Trans = Con.BeginTransaction Dim cmd As New OleDb.OleDbCommand("SELECT ItemName, Itemquantity ,Catagory,ItemPrice, Supplier ,Total FROM ItemIn = '" & txtSearchItem.Text & "' ", Con) Dr = cmd.ExecuteReader() // This line cause an error// Try If Dr.Read = False Then MsgBox("Item Name Is Not Found!!", MsgBoxStyle.Exclamation) Else ItemNameTextBox1.text = Dr("ItemName") ItemquantityTextBox1.text = Dr("Itemquantity") CatagoryTextBox.text = Dr("Catagory") ItemPriceTextBox1.text= Dr("ItemPrice") SupplierComboBox.text= Dr("Supplier") TotalMaskedTextBox.text= Dr("Total") End If Catch ex As Exception MsgBox(ex.Message) End Try Trans.Commit() Dr.Close() If Con.State <> ConnectionState.Closed Then Con.Close() End If end sub
im cmd As New OleDb.OleDbCommand("SELECT ItemName, Itemquantity ,Catagory,ItemPrice, Supplier ,Total FROM Item WHERE (column_name) = '" & txtSearchItem.Text & "' ", Con)
SELECT ... FROM table WHERE field=value
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)