Visual Basic Exception message:
Incorrect datatime value '' for column 'in_pub_date' at row 417
Mysql Stored prodcedure
DELIMITER$$
CREATE PEFINER='root'@'%' PROCEDURE 'SP_TEST'(
IN_DATE DATETIME
)
BEGIN
-- Do sth here
END
VB code
Case 1
With dbCommand
.CommandText = 'SP_TEST'
.Parameters.Clear()
.Parameter.AddWithValue("?IN_DATE","")
.CommandType = CommandType.StoredProcedure
End If
To
With dbCommand
.CommandText = 'SP_TEST'
.Parameters.Clear()
.Parameter.AddWithValue("?IN_DATE",DBNull.Value)
.CommandType = CommandType.StoredProcedure
End If
Case 2
With dbCommand
.CommandText = 'SP_TEST'
.Parameters.Clear()
.Parameter.AddWithValue("?IN_DATE", inDate) -- Where valse of inDate is ""
.CommandType = CommandType.StoredProcedure
End If
To
With dbCommand
.CommandText = 'SP_TEST'
.Parameters.Clear()
.Parameter.AddWithValue("?IN_DATE", IIF(NOT inDate = "", inDate, DBNull.Value))
.CommandType = CommandType.StoredProcedure
End If
No comments :
Post a Comment