Load Data On The Datagridview & Auto Text Searching in Windows Application With help of SQL -2022

Load Data On The Datagridview & Auto Text Searching in Windows Application With help of SQL -2022

Show All Data 


Code-

Imports System.Data.SqlClient

Imports System.Data

Public Class PathDayBook

    Public sqL As String

    Public dr As SqlDataReader

      Dim rdr As SqlDataReader

    Dim con As SqlConnection

    Dim cmd As SqlCommand

    Dim dt As DataTable

    Private Sub PathDayBook_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        BindGrid()

    End Sub

    Private Sub BindGrid()

        Using con As New SqlConnection(CnString)

            Using cmd As New SqlCommand("SELECT  BookingDate, BookingNo, RegNo, PatientsName,

Consultant, ModeofPayment, TotalAmount, DiscountAmount, AdvanceAmount, NetBalance FROM booking", con)

                cmd.CommandType = CommandType.Text

                Using sda As New SqlDataAdapter(cmd)

                    Using ds As New DataSet()

                        sda.Fill(ds)

                        DataGridView2.Columns(1).DataPropertyName = "BookingDate"

                        DataGridView2.Columns(2).DataPropertyName = "BookingNo"

                        DataGridView2.Columns(3).DataPropertyName = "RegNo"

                        DataGridView2.Columns(4).DataPropertyName = "PatientsName"

                        DataGridView2.Columns(5).DataPropertyName = "Consultant"

                        DataGridView2.Columns(6).DataPropertyName = "ModeofPayment"

                        DataGridView2.Columns(7).DataPropertyName = "TotalAmount"

                        DataGridView2.Columns(8).DataPropertyName = "DiscountAmount"

                        DataGridView2.Columns(9).DataPropertyName = "AdvanceAmount"

                        DataGridView2.Columns(10).DataPropertyName = "NetBalance"

                        DataGridView2.DataSource = ds.Tables(0)

                        DataGridView2.BackColor = Color.Red

                    End Using

                End Using

            End Using

        End Using

    End Sub

    Private Sub CloudTextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CloudTextBox3.TextChanged

        con = New SqlConnection(CnString)

        con.Open()

        adapt = New SqlDataAdapter("  SELECT  BookingDate, BookingNo, RegNo, PatientsName,

Consultant, ModeofPayment, TotalAmount, DiscountAmount, AdvanceAmount, 

NetBalance FROM booking WHERE BookingNo LIKE '" & CloudTextBox3.Text & "%'", con)

        dt = New DataTable()

        adapt.Fill(dt)

        DataGridView2.DataSource = dt

        con.Close()

    End Sub

    Private Sub CloudTextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CloudTextBox1.TextChanged

        con = New SqlConnection(CnString)

        con.Open()

        adapt = New SqlDataAdapter("  SELECT  BookingDate, BookingNo, RegNo, 

PatientsName, Consultant, ModeofPayment, TotalAmount, DiscountAmount,

AdvanceAmount, NetBalance FROM booking WHERE RegNo LIKE '" & CloudTextBox1.Text & "%'", con)

        dt = New DataTable()

        adapt.Fill(dt)

        DataGridView2.DataSource = dt

        con.Close()

    End Sub

    Private Sub CloudTextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CloudTextBox2.TextChanged

        con = New SqlConnection(CnString)

        con.Open()

        adapt = New SqlDataAdapter("  SELECT  BookingDate, BookingNo, RegNo,

PatientsName, Consultant, ModeofPayment, TotalAmount, DiscountAmount, 

AdvanceAmount, NetBalance FROM booking WHERE PatientsName LIKE '" & CloudTextBox2.Text & "%'", con)

        dt = New DataTable()

        adapt.Fill(dt)

        DataGridView2.DataSource = dt

        con.Close()

    End Sub

  

    Private Sub CloudButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CloudButton2.Click

        Me.Close()

    End Sub

           

     

End Class




2 Comments

  1. Review of the UK online casino site - ChoEgoCasino
    Check out our review of the best UK casino site. Check if online casinos are fair and safe in 2021! Find out what kind of bonuses you can 카지노 꽁 머니 get!

    ReplyDelete
  2. The best sports toto | Sporting100.com
    Betting Site with the Best Odds on Soccer. 토토사이트 Compare Odds to Bet on Soccer. 출장마사지 We'll jancasino.com give 카지노 사이트 you the 더킹카지노 슬롯 best online sportsbooks and odds.

    ReplyDelete
Previous Post Next Post

Design a beautiful Login/Signup (with google map) in Flutter | Flutter UI | VS Code | iOS Android