Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

how to i refresh datagridview in VB.NET ?

$
0
0
 i have 2 forms and this code is when i'm update my record but in my main form the datagridview can not be refreshed ...plz any one help me

Dim CON1 As New SqlConnection("Data Source=(LocalDB)\v11.0;AttachDbFilename=G:\Ganpatibapa\hostel\hostel\Database2.mdf;Integrated Security=True")
        Dim cmd1 As New SqlCommand
        Dim i As Integer
        cmd1.Connection = CON1
        CON1.Open()
        cmd1.CommandText = "update AHostel set Name='" & Registration.txtstudentname.Text & "',DOB='" & Registration.dob.Value & "', S_Number='" & Registration.txtstudentphone.Text& "', F_Number='" & Registration.txtfatherphone.Text & "', College='" & Registration.cbcollege.Text & "', Branch='" & Registration.cbbranch.Text & "', Address='" & Registration.txtaddress.Text& "', Distict='" & Registration.cbdistrict.Text & "',Blood='" & Registration.Blood.Text & "' ,Physical='" & Registration.physical.Text & "' where Room='" & v & "' and Name= '"& c2 & "';"

        i = cmd1.ExecuteNonQuery()
        If i > 0 Then

            MsgBox("student information Edited")


        Else

            MsgBox("not added")
        End If
    End Sub

           

Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>