codingrocks
New member
- Joined
- Apr 9, 2009
- Messages
- 1
- Programming Experience
- Beginner
I have developed an ASP .NET application in which I am passing some date type input parameters to database.
here is how i pass it
cmdRequests.Parameters.Add("@DateEntered", SqlDbType.DateTime).Direction = ParameterDirection.Input
If (Convert.ToString(txtDateEntered.Text) = String.Empty) Then
cmdRequests.Parameters("@DateEntered").Value = DBNull.Value
Else
cmdRequests.Parameters("@DateEntered").Value = txtDateEntered.Text
End If
But I am getting error saying "String parameter cannot be converted to datetime"
The input parameter type in stored procedure is varchar and i am trying to convert it to varchar
SET @CONDDATEENTERED= ' R.DateEntered = '''+ ''+ (CONVERT(VARCHAR(20),@date,101))
here is how i pass it
cmdRequests.Parameters.Add("@DateEntered", SqlDbType.DateTime).Direction = ParameterDirection.Input
If (Convert.ToString(txtDateEntered.Text) = String.Empty) Then
cmdRequests.Parameters("@DateEntered").Value = DBNull.Value
Else
cmdRequests.Parameters("@DateEntered").Value = txtDateEntered.Text
End If
But I am getting error saying "String parameter cannot be converted to datetime"
The input parameter type in stored procedure is varchar and i am trying to convert it to varchar
SET @CONDDATEENTERED= ' R.DateEntered = '''+ ''+ (CONVERT(VARCHAR(20),@date,101))