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
| Private Sub ValidCreation_Click(sender As Object, e As EventArgs) Handles ValidCreation.Click
Dim myConnection As OracleConnection
myConnection = New OracleConnection()
myConnection.ConnectionString = "USER ID=system;password=oracle;"
Dim x As String
Dim rep As MsgBoxResult
x = DayBox.Text + "-" + MonthBox.Text + "-" + YearBox.Text
If AcceuilElec.Select_Reg.Selected Then
Me.E = New Election(AcceuilElec.Select_Reg.Text, CDate(x), TourListBox.Text)
ElseIf (AcceuilElec.SelectMin.Selected) Then
Me.E = New Election(AcceuilElec.SelectMin.Text, CDate(x), TourListBox.Text)
Else
Me.E = New Election(AcceuilElec.SelectPres.Text, CDate(x), TourListBox.Text)
End If
Try
myConnection.Open()
Dim cm As OracleCommand = New OracleCommand()
cm.CommandText = "INSERT INTO elec (dte,type,tour) Values (" + Me.E.dte + ",'" + Me.E.type + "','" + Me.E.Tour + "')"
cm.Connection = myConnection
Dim b As Integer = cm.ExecuteNonQuery()
cm.CommandText = "select * from elec"
Dim dr As OracleDataReader = cm.ExecuteReader()
While dr.Read()
rep = MsgBox((dr(0) & dr(1) & dr(2)))
End While
cm.Connection.Close()
Catch ex As OracleException
rep = MsgBoxResult.Cancel
End Try
End Sub |
Partager