Basically, I have part of this code for calling the stored procedures for update purpose:
Private Sub submit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim strMessage As String
Dim moddate As DateTime
Dim createdate As DateTime
update strd proc
Btn_Cancel.Visible = False
Btn_Save.Text = "Add"
lblEmpNo.Visible = False
lblIssueDate.Visible = False
lblReturnedDate.Visible = False
strMessage = "Update successfull"
t_Serial.ReadOnly = True
Dim dbconn As New SqlConnection(strconn)
dbconn.Open()
Dim cmdNew As New SqlCommand("SPHERE", dbconn) calling the stored procedure here
cmdNew.CommandType = CommandType.StoredProcedure
createdate = Now()
moddate = Now()
Dim Selected As DateTime
Dim IssueDate As String
Dim ReturnDate As String
IssueDate = Issue_Day.SelectedValue & Issue_Month.SelectedValue & Issue_Year.SelectedValue
ReturnDate = ReturnedDate_Day.SelectedValue & ReturnedDate_Month.SelectedValue & ReturnedDate_Year.SelectedValue
IssueDate = CDate(Selected)
ReturnDate = CDate(Selected)
cmdNew.Parameters.Add("@barcode_no", SqlDbType.VarChar, 20).Value = t_Serial.Text & ""
cmdNew.Parameters.Add("@employee_id", SqlDbType.BigInt).Value = CInt(t_EmpNo.Text & "")
cmdNew.Parameters.Add("@issue_date", SqlDbType.BigInt).Value = IssueDate
cmdNew.Parameters.Add("@return_date", SqlDbType.DateTime).Value = ReturnDate
Dim cmdRun As New SqlDataAdapter
cmdRun.InsertCommand = cmdNew
cmdRun.InsertCommand.ExecuteNonQuery()
Dim strScript As String = "<script language=JavaScript>"
strScript += "alert(""" & strMessage & """);"
strScript += "</script>"
If (Not Page.IsStartupScriptRegistered("clientScript")) Then
Page.RegisterStartupScript("clientScript", strScript)
End If
End Sub
------
whenever I fill in the textbox and select for the date, and click the submit button, it does not do the update.. and the error message comes out highlighted the
cmdRun.InsertCommand.ExecuteNonQuery() part.. and says that the input is not in correct format.
Need help with this..tq=)
Private Sub submit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim strMessage As String
Dim moddate As DateTime
Dim createdate As DateTime
update strd proc
Btn_Cancel.Visible = False
Btn_Save.Text = "Add"
lblEmpNo.Visible = False
lblIssueDate.Visible = False
lblReturnedDate.Visible = False
strMessage = "Update successfull"
t_Serial.ReadOnly = True
Dim dbconn As New SqlConnection(strconn)
dbconn.Open()
Dim cmdNew As New SqlCommand("SPHERE", dbconn) calling the stored procedure here
cmdNew.CommandType = CommandType.StoredProcedure
createdate = Now()
moddate = Now()
Dim Selected As DateTime
Dim IssueDate As String
Dim ReturnDate As String
IssueDate = Issue_Day.SelectedValue & Issue_Month.SelectedValue & Issue_Year.SelectedValue
ReturnDate = ReturnedDate_Day.SelectedValue & ReturnedDate_Month.SelectedValue & ReturnedDate_Year.SelectedValue
IssueDate = CDate(Selected)
ReturnDate = CDate(Selected)
cmdNew.Parameters.Add("@barcode_no", SqlDbType.VarChar, 20).Value = t_Serial.Text & ""
cmdNew.Parameters.Add("@employee_id", SqlDbType.BigInt).Value = CInt(t_EmpNo.Text & "")
cmdNew.Parameters.Add("@issue_date", SqlDbType.BigInt).Value = IssueDate
cmdNew.Parameters.Add("@return_date", SqlDbType.DateTime).Value = ReturnDate
Dim cmdRun As New SqlDataAdapter
cmdRun.InsertCommand = cmdNew
cmdRun.InsertCommand.ExecuteNonQuery()
Dim strScript As String = "<script language=JavaScript>"
strScript += "alert(""" & strMessage & """);"
strScript += "</script>"
If (Not Page.IsStartupScriptRegistered("clientScript")) Then
Page.RegisterStartupScript("clientScript", strScript)
End If
End Sub
------
whenever I fill in the textbox and select for the date, and click the submit button, it does not do the update.. and the error message comes out highlighted the
cmdRun.InsertCommand.ExecuteNonQuery() part.. and says that the input is not in correct format.
Need help with this..tq=)