- Messages
- 175
- Reaction score
- 0
- Points
- 26
Re: VB.NET Programming Corner! UPDATED!!!
boss salamat sa pagreply ... eto sinubukan ko, kaso ung huling na i-check na checkbox lang ang na sesave ng paulit-ulit kahit pa marami nmng checkbox ang naka check ...
PS: kung ilan ung checkbox nga naka check ganun rin kadami ung entries sa database ng huling checkbox na nai-check...
pwede pong ilagay nyo sa button nyo yung ganito..
sample lang po..
Code:foreach (DataGridViewRow row in dataGridView1.Rows) { if (row.Cells[CheckBoxColumn1.Name].Value = true) { ///kunin mo yung serial number } }
boss salamat sa pagreply ... eto sinubukan ko, kaso ung huling na i-check na checkbox lang ang na sesave ng paulit-ulit kahit pa marami nmng checkbox ang naka check ...
PS: kung ilan ung checkbox nga naka check ganun rin kadami ung entries sa database ng huling checkbox na nai-check...
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim serialnumber As String = DataGridView1.CurrentRow.Cells("SerialNumber").Value
Dim siteid As String = Main.StatusBar1.Panels(2).Text
Dim connection As New SqlConnection
Dim cmd As New SqlCommand
connection.ConnectionString = "Data Source =TOBZ-PC; Initial Catalog =Glowb; Integrated Security =SSPI;"
For Each row As DataGridViewRow In DataGridView1.Rows
If row.Cells(Column1.Name).Value = True Then
connection.Open()
cmd.Connection = connection
cmd.CommandText = " INSERT INTO [Equipment Request](SerialNumber, SiteID) VALUES('" & serialnumber & "', '" & siteid & "') "
cmd.ExecuteNonQuery()
connection.Close()
End If
Next
End Sub
Last edited: