Hello i am only getting this error everytime i try to update/edit data on a web form. the error is, Conversion from string "" to type 'Date' is not valid. can someone assist me please thanks. The Add form to this is working i even went over the Date field to ensure it is correct because from searching on the internet they referred to the Date field, but on the edit form this error is only popping up. please help!!
Conversion from string "" to type 'Date' is not valid
Collapse
X
-
To make things easier for all, post the code you're using and whats causing this error. Without seeing what and how you're doing this it's just a shot in the dark. -
Code:Protected Sub Find_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Find.Click Dim Department_ID As String = txtDepartmentID.Text Dim Sequence_ID As String = txtSequenceID.Text Dim Date_Requested As String = txtDateRequested.Text Dim _GET_FileTransacUpdate As New Records_Mgmt_BLL.FileTransac Dim key As DataRow = _GET_FileTransacUpdate.GET_FileTransacUpDate(Department_ID, Sequence_ID, Date_Requested) If IsDBNull(key(0)) Then txtDepartmentID.Text = "" Else txtDepartmentID.Text = key(0) End If If IsDBNull(key(1)) Then txtSequenceID.Text = "0" Else txtSequenceID.Text = key(1) End If If IsDBNull(key(2)) Then txtRequestingOfficer.Text = "" Else txtRequestingOfficer.Text = key(2) End If If IsDBNull(key(3)) Then txtDateRequested.Text = "1/1/2012" Else txtDateRequested.Text = key(3) End If If IsDBNull(key(4)) Then txtDateSent.Text = "1/1/2012" Else txtDateSent.Text = key(4) End If If IsDBNull(key(5)) Then txtDateReturned.Text = "1/1/2012" Else txtDateReturned.Text = key(5) End If If IsDBNull(key(6)) Then txtReturningDepartment.Text = "" Else txtReturningDepartment.Text = key(6) End If If IsDBNull(key(7)) Then txtReceivingOfficer.Text = "" Else txtReceivingOfficer.Text = key(7) End If If IsDBNull(key(8)) Then txtRemarks.Text = "" Else txtRemarks.Text = key(8) End If End Sub End Class
sorry for taking so long to respond. this is the code for the find/search button and below is the code for the update button
Code:Protected Sub cmdUpdate_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdUpdate.Click Dim UPDATE_FileTransacUpdate As New Records_Mgmt_BLL.FileTransac Dim _GET_FileTransacUpdate As New FileTransacUpdate Dim Department_ID As String = txtDepartmentID.Text Dim Sequence_ID As String = txtSequenceID.Text Dim Requesting_Officer As String = txtRequestingOfficer.Text Dim Date_Requested As String = txtDateRequested.Text Dim Date_Sent As String = txtDateSent.Text Dim Date_Returned As String = txtDateReturned.Text Dim Returning_Department As String = txtReturningDepartment.Text Dim Receiving_Officer As String = txtReceivingOfficer.Text Dim Remarks As String = txtRemarks.Text Try UPDATE_FileTransacUpdate.UpdateFileTransacUpdate(Department_ID, Sequence_ID, Date_Requested, Returning_Department, Receiving_Officer, Remarks) cmdUpdate.Visible = False Dim str As String = "<script>window.open('FileTransacUpdate.aspx?" & Department_ID & "','','height=320,width=1200')</script>" Page.ClientScript.RegisterStartupScript(Me.GetType(), "print_script", str) Catch ex As Exception MsgBox(ex.ToString) End Try End Sub
Please assist.Comment
Comment