Click here to Skip to main content
15,881,898 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Dataset containing nullable datetime values does not like a null datetime? Pin
kriskomar27-Feb-09 9:59
kriskomar27-Feb-09 9:59 
AnswerRe: Dataset containing nullable datetime values does not like a null datetime? Pin
PoweredByOtgc28-Feb-09 5:07
PoweredByOtgc28-Feb-09 5:07 
GeneralRe: Dataset containing nullable datetime values does not like a null datetime? Pin
kriskomar1-Mar-09 6:00
kriskomar1-Mar-09 6:00 
GeneralRe: Dataset containing nullable datetime values does not like a null datetime? Pin
PoweredByOtgc1-Mar-09 6:32
PoweredByOtgc1-Mar-09 6:32 
GeneralRe: Dataset containing nullable datetime values does not like a null datetime? Pin
kriskomar1-Mar-09 14:58
kriskomar1-Mar-09 14:58 
GeneralRe: Dataset containing nullable datetime values does not like a null datetime? Pin
PoweredByOtgc2-Mar-09 13:56
PoweredByOtgc2-Mar-09 13:56 
AnswerPartial fix for control not allowing null value to pass to dataset and database Pin
kriskomar3-Mar-09 6:45
kriskomar3-Mar-09 6:45 
AnswerRe: Dataset containing nullable datetime values does not like a null datetime? Pin
kriskomar4-Mar-09 7:05
kriskomar4-Mar-09 7:05 
Update:
Still nothing. I've even set my code to set any Null date to 1/1/1900 even though I really didnt want to do that. When I add a new record, no matter what, when i try to save back to the DB, I always get:
"Invalid cast from 'Int32' to 'DateTime'."
It shows the exception originates in the automatically generated "UpdateAll" Sub created by the dataset designer. Here is the code just before where the exception occurs:
Try
    '---- Prepare for update -----------
    '
    If (Not (Me._employeesTableAdapter) Is Nothing) Then
        revertConnections.Add(Me._employeesTableAdapter, Me._employeesTableAdapter.Connection)
        Me._employeesTableAdapter.Connection = CType(workConnection,Global.System.Data.SqlClient.SqlConnection)
        Me._employeesTableAdapter.Transaction = CType(workTransaction,Global.System.Data.SqlClient.SqlTransaction)
        If Me._employeesTableAdapter.Adapter.AcceptChangesDuringUpdate Then
            Me._employeesTableAdapter.Adapter.AcceptChangesDuringUpdate = false
            adaptersWithAcceptChangesDuringUpdate.Add(Me._employeesTableAdapter.Adapter)
        End If
    End If
    If (Not (Me._organizationMemosTableAdapter) Is Nothing) Then
        revertConnections.Add(Me._organizationMemosTableAdapter, Me._organizationMemosTableAdapter.Connection)
        Me._organizationMemosTableAdapter.Connection = CType(workConnection,Global.System.Data.SqlClient.SqlConnection)
        Me._organizationMemosTableAdapter.Transaction = CType(workTransaction,Global.System.Data.SqlClient.SqlTransaction)
        If Me._organizationMemosTableAdapter.Adapter.AcceptChangesDuringUpdate Then
            Me._organizationMemosTableAdapter.Adapter.AcceptChangesDuringUpdate = false
            adaptersWithAcceptChangesDuringUpdate.Add(Me._organizationMemosTableAdapter.Adapter)
        End If
    End If
    If (Not (Me._peopleTableAdapter) Is Nothing) Then
        revertConnections.Add(Me._peopleTableAdapter, Me._peopleTableAdapter.Connection)
        Me._peopleTableAdapter.Connection = CType(workConnection,Global.System.Data.SqlClient.SqlConnection)
        Me._peopleTableAdapter.Transaction = CType(workTransaction,Global.System.Data.SqlClient.SqlTransaction)
        If Me._peopleTableAdapter.Adapter.AcceptChangesDuringUpdate Then
            Me._peopleTableAdapter.Adapter.AcceptChangesDuringUpdate = false
            adaptersWithAcceptChangesDuringUpdate.Add(Me._peopleTableAdapter.Adapter)
        End If
    End If
    If (Not (Me._organizationsTableAdapter) Is Nothing) Then
        revertConnections.Add(Me._organizationsTableAdapter, Me._organizationsTableAdapter.Connection)
        Me._organizationsTableAdapter.Connection = CType(workConnection,Global.System.Data.SqlClient.SqlConnection)
        Me._organizationsTableAdapter.Transaction = CType(workTransaction,Global.System.Data.SqlClient.SqlTransaction)
        If Me._organizationsTableAdapter.Adapter.AcceptChangesDuringUpdate Then
            Me._organizationsTableAdapter.Adapter.AcceptChangesDuringUpdate = false
            adaptersWithAcceptChangesDuringUpdate.Add(Me._organizationsTableAdapter.Adapter)
        End If
    End If
    If (Not (Me._cSISelections2004TableAdapter) Is Nothing) Then
        revertConnections.Add(Me._cSISelections2004TableAdapter, Me._cSISelections2004TableAdapter.Connection)
        Me._cSISelections2004TableAdapter.Connection = CType(workConnection,Global.System.Data.SqlClient.SqlConnection)
        Me._cSISelections2004TableAdapter.Transaction = CType(workTransaction,Global.System.Data.SqlClient.SqlTransaction)
        If Me._cSISelections2004TableAdapter.Adapter.AcceptChangesDuringUpdate Then
            Me._cSISelections2004TableAdapter.Adapter.AcceptChangesDuringUpdate = false
            adaptersWithAcceptChangesDuringUpdate.Add(Me._cSISelections2004TableAdapter.Adapter)
        End If
    End If
    '
    '---- Perform updates -----------
    '
    If (Me.UpdateOrder = UpdateOrderOption.UpdateInsertDelete) Then
        result = (result + Me.UpdateUpdatedRows(dataSet, allChangedRows, allAddedRows))
        result = (result + Me.UpdateInsertedRows(dataSet, allAddedRows))
    Else
        result = (result + Me.UpdateInsertedRows(dataSet, allAddedRows))
        result = (result + Me.UpdateUpdatedRows(dataSet, allChangedRows, allAddedRows))
    End If
    result = (result + Me.UpdateDeletedRows(dataSet, allChangedRows))
    '
    '---- Commit updates -----------
    '
    workTransaction.Commit
    If (0 < allAddedRows.Count) Then
        Dim rows((allAddedRows.Count) - 1) As Global.System.Data.DataRow
        allAddedRows.CopyTo(rows)
        Dim i As Integer = 0
        Do While (i < rows.Length)
            Dim row As Global.System.Data.DataRow = rows(i)
            row.AcceptChanges
            i = (i + 1)
        Loop
    End If
    If (0 < allChangedRows.Count) Then
        Dim rows((allChangedRows.Count) - 1) As Global.System.Data.DataRow
        allChangedRows.CopyTo(rows)
        Dim i As Integer = 0
        Do While (i < rows.Length)
            Dim row As Global.System.Data.DataRow = rows(i)
            row.AcceptChanges
            i = (i + 1)
        Loop
    End If
Catch ex As Global.System.Exception
    workTransaction.Rollback
    '---- Restore the dataset -----------
    If Me.BackupDataSetBeforeUpdate Then
        Global.System.Diagnostics.Debug.Assert((Not (backupDataSet) Is Nothing))
        dataSet.Clear
        dataSet.Merge(backupDataSet)
    Else
        If (0 < allAddedRows.Count) Then
            Dim rows((allAddedRows.Count) - 1) As Global.System.Data.DataRow
            allAddedRows.CopyTo(rows)
            Dim i As Integer = 0
            Do While (i < rows.Length)
                Dim row As Global.System.Data.DataRow = rows(i)
                row.AcceptChanges
                row.SetAdded
                i = (i + 1)
            Loop
        End If
    End If
    Throw ex
Finally

That "ex" exception is thrown and I get the error above. There are no Int32's being cast to datetime. all int32's are int32's and all datetime's are datetime's...what in the heck is happening?
GeneralRe: Dataset containing nullable datetime values does not like a null datetime? Pin
kriskomar5-Mar-09 4:58
kriskomar5-Mar-09 4:58 
Questionhow to do the custom installation of vb.net windows applications project ? [modified] Pin
pramod251727-Feb-09 2:08
pramod251727-Feb-09 2:08 
AnswerRe: how to do the custom installation of vb.net windows applications project ? Pin
Eddy Vluggen27-Feb-09 2:34
professionalEddy Vluggen27-Feb-09 2:34 
AnswerRe: how to do the custom installation of vb.net windows applications project ? Pin
Jon_Boy27-Feb-09 2:43
Jon_Boy27-Feb-09 2:43 
QuestionVB.Net and C# and VC++ in single project Pin
Samir Ibrahim26-Feb-09 23:35
Samir Ibrahim26-Feb-09 23:35 
AnswerRe: VB.Net and C# and VC++ in single project Pin
Smithers-Jones27-Feb-09 0:13
Smithers-Jones27-Feb-09 0:13 
AnswerRe: VB.Net and C# and VC++ in single project Pin
Jon_Boy27-Feb-09 2:38
Jon_Boy27-Feb-09 2:38 
AnswerRe: VB.Net and C# and VC++ in single project Pin
Dave Kreskowiak27-Feb-09 7:52
mveDave Kreskowiak27-Feb-09 7:52 
QuestionHow to send E-Mail from VB.Net from [modified] Pin
palathoti26-Feb-09 21:56
palathoti26-Feb-09 21:56 
AnswerRe: How to send E-Mail from VB.Net from Pin
Eddy Vluggen26-Feb-09 22:38
professionalEddy Vluggen26-Feb-09 22:38 
GeneralRe: How to send E-Mail from VB.Net from Pin
palathoti26-Feb-09 23:40
palathoti26-Feb-09 23:40 
Questionread from ini file Pin
dec8226-Feb-09 21:32
dec8226-Feb-09 21:32 
AnswerRe: read from ini file Pin
Eddy Vluggen26-Feb-09 22:40
professionalEddy Vluggen26-Feb-09 22:40 
QuestionGet the all selected value of listbox window project in vb.net Pin
Jagz W26-Feb-09 20:28
professionalJagz W26-Feb-09 20:28 
AnswerRe: Get the all selected value of listbox window project in vb.net [modified] Pin
Eddy Vluggen26-Feb-09 21:49
professionalEddy Vluggen26-Feb-09 21:49 
GeneralRe: Get the all selected value of listbox window project in vb.net Pin
Jagz W26-Feb-09 23:27
professionalJagz W26-Feb-09 23:27 
AnswerRe: Get the all selected value of listbox window project in vb.net Pin
Eddy Vluggen26-Feb-09 23:42
professionalEddy Vluggen26-Feb-09 23:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.