I can't figure out how to check if the date variable the web service is accepting (datStartDate) is blank or null from the form, and if null/blank then submit a Null value to the database, if not null send the date the form is sending.
I have tried Nullable(Of Date) check on that variable and also hasvalue but can't get it to work.
thanks for you help
this is hte code i am currently using and works great if i actually submit a value
Expand|Select|Wrap|Line Numbers
- <WebMethod(Description:="")> _
- Public Function SubmitAppData(ByVal strAppID As String, ByVal datStartDate As Date) As Integer
- Dim sqlCon As New SqlConnection()
- Dim sqlCmd As New SqlCommand()
- 'sqlCon.ConnectionString = "connection string info"
- sqlCon.ConnectionString = connStr
- If sqlCon.State = ConnectionState.Closed Then
- sqlCon.Open()
- End If
- sqlCmd.CommandText = "usp_SendValues"
- sqlCmd.Connection = sqlCon
- sqlCmd.CommandType = CommandType.StoredProcedure
- 'Dim maxDate As Nullable(Of Date)
- 'maxDate = datDRLastTestDate
- Dim Parameter1 As SqlParameter = New SqlParameter("@AppID", strAppID)
- Dim Parameter2 As SqlParameter = New SqlParameter("@StartDate", datStartDate)
- Parameter1.Direction = ParameterDirection.Input
- Parameter2.Direction = ParameterDirection.Output
- sqlCmd.Parameters.Add(Parameter0)
- sqlCmd.Parameters.Add(Parameter1)
- Dim dr As SqlDataReader
- dr = sqlCmd.ExecuteReader()
- sqlCon.Close()
- Dim returnValue as String = "Hello"
- Return returnValue
- End Function