how to.... please..
-
Wednesday, March 07, 2012 1:13 PM
i have a txtbox(for barcode).. if i input a item number in that txtbox and if that number will match in your database, the other information(shall we say, product type, item ID, etc..) will display in my other txtboxes..
can you please help me how to code this?
All Replies
-
Wednesday, March 07, 2012 1:25 PM
-
Wednesday, March 07, 2012 1:39 PM
Below is an ADO.NET tutorial. When you get to the Structured Query Language section you will just need to add a WHERE clause to the SQL statement to return data based upon the item number.
http://www.homeandlearn.co.uk/net/nets12p1.html
Paul ~~~~ Microsoft MVP (Visual Basic)
-
Wednesday, March 07, 2012 2:10 PM
here is my example output.. it has a database..
-
Wednesday, March 07, 2012 2:24 PM
Below is an example of the lookup code. Keep in mind that I do not know what type of database you are working with, the table and column names and their corresponding data types.
Dim AccessConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=C:\Test Files\db1 XP.mdb") Dim AccessCommand As New OleDbCommand("SELECT * FROM TableName WHERE ItemNumber = ?", AccessConnection) AccessCommand.Parameters.AddWithValue("Param1", ItemNumberTextBox.Text) Dim AccessAdapter As New OleDbDataAdapter(AccessCommand) Dim AccessDataSet As New DataSet() AccessAdapter.Fill(AccessDataSet, "Items") Dim RowCount As Integer = AccessDataSet.Tables("Items").Rows.Count If RowCount > 0 Then ProductTypeTextBox.Text = AccessDataSet.Tables("Items").Rows(RowCount - 1)("ProductType").ToString ItemIDTextBox.Text = AccessDataSet.Tables("Items").Rows(RowCount - 1)("ItemID").ToString TotalAmountTextBox.Text = AccessDataSet.Tables("Items").Rows(RowCount - 1)("TotalAmount").ToString End IfPaul ~~~~ Microsoft MVP (Visual Basic)
- Marked As Answer by L O S T Wednesday, March 07, 2012 2:45 PM
-
Wednesday, March 07, 2012 2:45 PMThanks a lot Paul

