I'm creating a database app based on many of the concepts in the Beginning VB05 Databases book (Similar to TimeTracker - totally different purpose). The MS Access 2003 db that sits under has a list of projects and dates including: Early Start, Baseline Start, Actual Start, Baseline Finish Actual Finish. Of course as some projects may not have actually finished there will be blanks in some fields.
My problems are two:
Using objData to populate the list view of Projects as follows. Any blank dates cause the ListView control to stop populating - it doesn't throw an exception - just stops populating. Am I doing something terribly wrong?
Get all projects in a DataReader object
objData.SQL = "usp_ProjectDetails"
objData.DataReader = objData.Command.ExecuteReader
'See if any data exists before continuing
If objData.DataReader.HasRows Then
'Process all rows
'create a new ListViewItem
objListViewItem = New ListViewItem
'add data to the listviewitem
objListViewItem.Tag = objData.DataReader.Item("Project_ID")
'add the subitems to the listviewitem
objListViewItem.Text = objData.DataReader.Item("Project_Title")
'add the listviewitem to the listview control
Catch ExceptionErr As Exception
I'm trying to insert projects with dates into the Database. But I consistently get a failed to convert String to DateTime error. This one is driving me batty.
Here's a line of the insertion code:
objData.AddParameter("@Early_Start", OleDb.OleDbType.DBDate, 20, CType(txtADProjectCurrentStart.Text, Date))
The parameter is @Early_Start in the SQL line and the format in Access in DateTime. The SQL usp works fine in Access with the same format data as appears in the text box.
ANY help appreciated as this is stumping me on an otherwise great app!