1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
Private Sub miValiderChgnts_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miValiderChgnts.Click
Dim SqlConnectionObj As SqlClient.SqlConnection
Dim SqlCommandObj As SqlClient.SqlCommand
Dim SqlDataAdapterObj As SqlClient.SqlDataAdapter
Dim SqlRequestString As String
Dim SqlRequestString2 As String
Try
SqlConnectionObj = New SqlClient.SqlConnection(GetSqlConnectionString("POSTE03\POSTEDEV", "sa", "Spirou", "AudioVideo", "BaseDeDonnes"))
SqlConnectionObj.Open()
SqlCommandObj = New SqlClient.SqlCommand
SqlCommandObj.Connection = SqlConnectionObj
SqlCommandObj.CommandType = CommandType.Text
SqlCommandObj.CommandTimeout = 60
For Each row As DataRow In DataSetAvailable.Tables("OccurencesEmissions").Select("IsRecorded = TRUE", "", DataViewRowState.ModifiedCurrent)
Dim value As Byte = 0
MessageBox.Show(row("IsRecorded").ToString)
If row("IsRecorded").ToString = "True" Then
value = 1
End If
SqlRequestString = "INSERT INTO Recorded" & _
"(IdAvailable, Chaine, Canal, Name, StartTime, EndTime)" & _
"VALUES" & _
"(" & row("IdAvailable").ToString & ", '" & row("Chaine").ToString & "' , " & row("Canal").ToString & ",'" & row("Name").ToString & "', '" & row("StartTime").ToString & "', '" & row("EndTime").ToString & "')"
SqlRequestString2 = "UPDATE Available" & _
" SET IsRecorded = " & value.ToString
SqlCommandObj.CommandText = SqlRequestString
SqlCommandObj.ExecuteNonQuery()
SqlCommandObj.CommandText = SqlRequestString2
SqlCommandObj.ExecuteNonQuery()
Next
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
If Not SqlConnectionObj Is Nothing Then
SqlConnectionObj.Close()
SqlConnectionObj.Dispose()
SqlConnectionObj = Nothing
End If
End Try
End Sub |
Partager