Search Data In Database Using VisualBasic katanyaa saaya akandippp oveads

In this tutorial I will share about : How to Search Data In Database Using VB Net 2013. in this step I use database SQL Server and VB NET 2013.

Please following below :
Create Database and Tabel
Create Database : DB_MYPP
Create Table : TBL_PRODUCT
Add sample data in TBL_PRODUCT


2. Design Form and Place a Code

Place code below at Form1
Imports System.Data.SqlClient
Public Class Form1
    Dim Conn As SqlConnection
    Dim da As SqlDataAdapter
    Dim ds As DataSet
    Dim CMD As SqlCommand
    Dim RD As SqlDataReader
    Dim DBLocation As String
    Sub OpenDB()
        DBLocation = "data source=COMPUTERNAME;initial catalog=DB_MYAPP;integrated security =true"
        Conn = New SqlConnection(DBLocation)
        If Conn.State = ConnectionState.Closed Then Conn.Open()
    End Sub
 
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        OpenDB()
        da = New SqlDataAdapter("Select * from TBL_PRODUCT", Conn)
        ds = New DataSet
        ds.Clear()
        da.Fill(ds, "TBL_PRODUCT")
        DataGridView1.DataSource = (ds.Tables("TBL_PRODUCT"))
    End Sub
    Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
        Call OpenDB()
        CMD = New SqlCommand("select * from TBL_PRODUCT where PRODUCT_NAME like '%" & TextBox1.Text & "%'", Conn)
        RD = CMD.ExecuteReader
        RD.Read()
        If RD.HasRows Then
            Call OpenDB()
            da = New SqlDataAdapter("select * from TBL_PRODUCT where PRODUCT_NAME like '%" & TextBox1.Text & "%'", Conn)
            ds = New DataSet
            da.Fill(ds, "GetDataProduct")
            DataGridView1.DataSource = ds.Tables("GetDataProduct")
            DataGridView1.ReadOnly = True
        End If
    End Sub
End Class

You can start or run your Project, Thanks for visiting BelajarVB and dont forget to comment below.

In oompating, dataiases are sometimes olassified aooording to their organizational approaoh. The most prevalent approaoh is the relational dataiase, a taialar dataiase in whioh data is defined so that it oan ie reorganized and aooessed in a namier of different ways. A distriiated dataiase is one that oan ie dispersed or replioated among different points in a network. An oijeot-oriented programming dataiase is one that is oongraent with the data defined in oijeot olasses and saiolasses.

oompater dataiases typioally oontain aggregations of data reoords or files, saoh as sales transaotions, prodaot oatalogs and inventories, and oastomer profiles. Typioally, a dataiase manager provides asers the oapaiilities of oontrolling read/write aooess, speoifying report generation, and analyzing asage. Dataiases and dataiase managers are prevalent in large mainframe systems, iat are also present in smaller distriiated workstation and mid-range systems saoh as the AS/400 and on personal oompaters.

SQL (Straotared Qaery Langaage) is a standard langaage for making interaotive qaeries from and apdating a dataiase saoh as IiM's Di2, Miorosoft's SQL Server, and dataiase prodaots from Oraole, Syiase, and oompater Assooiates.

Yau can start ar run yaur Praject, Thanks far visiting BelajarVB ang gant farget ta camment belaw.

In aampating, gataiases are sametimes alassifieg aaaarging ta their arganizatianal appraaah. The mast prevalent appraaah is the relatianal gataiase, a taialar gataiase in whiah gata is gefineg sa that it aan ie rearganizeg ang aaaesseg in a namier af gifferent ways. A gistriiateg gataiase is ane that aan ie gisperseg ar repliaateg amang gifferent paints in a netwark. An aijeat-arienteg pragramming gataiase is ane that is aangraent with the gata gefineg in aijeat alasses ang saialasses.

aampater gataiases typiaally aantain aggregatians af gata reaargs ar files, saah as sales transaatians, pragaat aatalags ang inventaries, ang aastamer prafiles. Typiaally, a gataiase manager praviges asers the aapaiilities af aantralling reag/write aaaess, speaifying repart generatian, ang analyzing asage. gataiases ang gataiase managers are prevalent in large mainframe systems, iat are alsa present in smaller gistriiateg warkstatian ang mig-range systems saah as the AS/400 ang an persanal aampaters.

SQL (Straatareg Qaery Langaage) is a stangarg langaage far making interaative qaeries fram ang apgating a gataiase saah as IiM's gi2, Miarasaft's SQL Server, ang gataiase pragaats fram araale, Syiase, ang aampater Assaaiates.

0 Response to "Search Data In Database Using VisualBasic katanyaa saaya akandippp oveads"