我有一个存储过程,它读入TimeStamp。 在我的程序中,我有一个DatePicker和一个TimePicker,然后我转换为一个String,格式与TimeStamp相同,即。 " timestamp' 2009-09-09 09:30:25 CET'"
但是,尝试运行该过程时出现以下错误。
这是VB代码(前半部分基本上是将DatePicker值转换为TimeStamp格式的字符串):
Dim cmd As New OracleCommand("SYSTEM.ADDSCREENING", ChooseTable.Connect())
Dim timeStamp As String = "timestamp'2009-12-31 09:30:25 CET'"
Dim dateRaw As String = dtpStartDate.Text
Dim dateArray() As String = Split(timeStamp, "-")
Dim dateYear As String = dateArray(0)
Dim dateMonth As String = dateArray(1)
Dim dateArray2() As String = Split(dateArray(2), " ")
Dim dateDay As String = dateArray2(0)
Dim timeRaw As String = dtpStartTime.Text
Dim timeFinal As String = timeRaw + ":00 GMT"
Dim timeStampFinal As String = dateYear + "-" + dateMonth + "-" + dateDay + " " + timeFinal + "'"
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add("@SCREENID", Val(cboScreen.Text))
cmd.Parameters.Add("@FILMID", Val(cboFilm.Text))
cmd.Parameters.Add("@STARTTIME", timeStampFinal)
Try
cmd.ExecuteNonQuery()
MsgBox("Record Added")
Catch ex As Exception
MsgBox(ex.Message)
End Try
RefreshDB()