JumpyNET
Well-known member
- Joined
- Apr 4, 2005
- Messages
- 151
Im trying to retrieve a datetime value from SQL, but Im getting nags about not being able to convert object to date. Directcast and ctype didnt work either. Any advice how this should be done?
PS: Im using SSIS 2005.
Code:
Dim TmpTime As Date
Dim Query As String
Query = "SET @maxdate = SELECT MAX(DateAndTime) FROM MyTable"
Dim sqlCmd As SqlCommand = New SqlCommand(Query, sqlConn)
sqlCmd.Parameters.Add("@maxdate", SqlDbType.DateTime)
sqlCmd.ExecuteNonQuery()
TmpTime = sqlCmd.Parameters("@maxdate").Value I GET THE ERROR HERE
PS: Im using SSIS 2005.