I need to have output parameter which data type is date on vb.net. I know how to do it for integer. Would someone tell me how to do it for date. I am not sure the size.
paramOut = New SqlParameter("@OrderID", SqlDbType.Int, 4, ParameterDirection.InputOutput, True, 10, 0, "@OrderID", DataRowVersion.Current, DBNull.Value)
No need to specify size at all. Do this
VB.NET
Dim outputParm As New SqlParameter With {
.Direction = ParameterDirection.Output,
.ParameterName = "@OrderID",
.SqlDbType = SqlDbType.Date}
command.Parameters.Add(outputParm)
SqlParameter outputParm = new SqlParameter { Direction = System.Data.ParameterDirection.Output, ParameterName = "@OrderID", SqlDbType = System.Data.SqlDbType.Date }; command.Parameters.Add(outputParm);
试试SqlDbType.DateTime
这里是那些数据成员的很好参考
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.