Searching Columns Value in MS Access Using VB.Net

This tutorial is all about Searching Columns Value in MS Access Using VB.Net. In this post i will teach you on Searching Columns Value in MS Access Using VB.Net. So let’s get started:

As a continuation of this tutorial. We will use the Displaying Data Table Records in Datagridview using VB.Net

  • First, Design your Form like this one below.
    Add a Textbox and a Button.

  • After designing the form add this following declaration.
    [vbnet]
    Public dbdt As New DataTable
    [/vbnet]
  • Click the Search Button and Add this code.
    [vbnet]
    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
    TryMyconnection.Open()
    dbdt = New DataTable

    With dbcmd
    .Connection = Myconnection
    .CommandText = “Select * from tblitems where ITEMNAME like ‘” & TextBox4.Text & “%'”
    End With

    dbda.SelectCommand = dbcmd
    dbda.Fill(dbdt)

    DataGridView1.DataSource = dbdt

    Catch ex As Exception
    MsgBox(ex.Message)
    End Try
    dbda.Dispose()

    Myconnection.Close()
    End Sub

    [/vbnet]

  • Then Click F5 to Run the Program.
    Output.

 

 

If you have any comments or suggestions about on Searching Columns Value in MS Access Using VB.Net, please feel free to contact our webpage.

Download Searching Columns Value in MS Access Using VB.Net Here

Other Articles Readers might read:

 

Leave a Comment