Snosky
Member
- Joined
- Dec 28, 2005
- Messages
- 17
- Programming Experience
- 1-3
I have 2 DateTimePickers on a form
in the form code the following happens
>> reservation class
>> Connection Class
When i click on the button reservation
I get this error :
An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll
Additional information: Systemerror.
somebody a solution?
thanx in advance!
in the form code the following happens
VB.NET:
Private Sub btnReservation_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReserveer.Click
Dim ReservationAs New ReservationClass
Dim From_date As Date
Dim To_date As Date
From_date = datetimepickerFrom_date.Value
To_date = datetimepickerTo_date.Value
reservation.Add_reservation_2(Me.cboOrderID, From_date, To_date, Me.cboAutoID)
End Sub
VB.NET:
Public Sub Add_reservation_2(ByVal OrderID, ByVal FromDate, ByVal ToDate, ByVal AutoID)
Dim con1 As New ClaConnectionOrder
con1.conAdd_in_orderline(OrderID, FromDate, ToDate, AutoID)
End Sub
VB.NET:
Public Class ClaConnectionOrder
Dim conStr As String = "workstation id=LAPTOP_IMS;packet size=4096;integrated security=SSPI;data source=LAPTOP_IMS;persist security info=False;initial catalog=CARS"
Dim sqlStr As String = "SELECT * FROM Order_lijn ol, Orders o where ol.Order_ID = o.Order_ID"
'Connectie object creeeren
Dim connection As New SqlConnection(conStr)
'Data adaptor object creeeren
Dim adapter As New SqlDataAdapter(sqlStr, connection)
'Dataset creeeren en met data van adaptor vullen
Dim ds As DataSet = New DataSet
Dim dv As DataView
Dim obrow As Data.DataRow
Dim obds As DataSet = New DataSet
Dim obbi As SqlClient.SqlCommandBuilder
Dim customers As DataTable
Public Sub conOpen()
adapter.Fill(ds, "Order_line")
dv = ds.Tables("Order_line").DefaultView
End Sub
Public Sub conClose()
adapter.Dispose()
End Sub
Public Sub conAdd_in_orderline(ByVal OrderID As ComboBox, ByVal FromDate As DateTimePicker, ByVal ToDate As DateTimePicker, ByVal AutoID As ComboBox)
connection.Open()
Dim sqlStr As String
sqlStr = "insert into Order_lijn(Order_ID,Auto_ID,Begin_periode, Eind_periode) values ('" & OrderID.SelectedValue & "','" & AutoID.SelectedValue & "', '" & FromDate.Date & "','" & ToDate.Date & "')"
Dim objCmd As New SqlCommand(sqlStr, connection)
objCmd.ExecuteNonQuery()
End Sub
I get this error :
An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll
Additional information: Systemerror.
somebody a solution?
thanx in advance!