southdowns
New member
- Joined
- Dec 16, 2010
- Messages
- 1
- Programming Experience
- 10+
Hi, I have a problem where all my dates are saving as 01/01/1900 when using Today.Date
The code I am using is
The computer time is correct, and when tracking the variable using stops and the watch tool, all the way through to saving, the date is displayed correctly. However, after saving the date is the default value, 01/01/1900
Any help would be appreciated
The code I am using is
VB.NET:
If k = 0 Then
'open connect to database
connect()
'clear the dataset to avoid data collisions
ds.Clear()
'clear the select command
sc = ""
'building the select command using the textboxes
sc = "INSERT INTO tblJob (JobNum, OrderNum, CustomerID, LabourCost, MaterialCost, VAT, JobTotal, DateEntered) VALUES ("
sc += "'" & frmJobDetails.txtJobNo.Text & "', "
sc += "'" & frmJobDetails.txtOrderNo.Text & "', "
sc += "'" & frmJobDetails.cmbCustomerName.Text & "', "
sc += "'" & frmJobDetails.txtLabour.Text & "', "
sc += "'" & frmJobDetails.txtMaterials.Text & "', "
sc += "'" & frmJobDetails.txtVAT.Text & "', "
sc += TotalCost.ToString("C") & ", "
sc += Today.Date & ")"
'creates a new data adapter using the select command and dbconn, which inserts new row into tblJob
da = New SqlDataAdapter(sc, dbconn)
da.Fill(ds, "tblJob")
Else : MsgBox("A job with this Job Number already exists.")
End If
SQLdr.Close()
dbconn.Close()
The computer time is correct, and when tracking the variable using stops and the watch tool, all the way through to saving, the date is displayed correctly. However, after saving the date is the default value, 01/01/1900
Any help would be appreciated
Last edited: