Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Pinto
Aged Yak Warrior
590 Posts |
Posted - 2006-01-05 : 10:23:57
|
| I have an sp which I should return the latest date in my sql table. Howver I am getting this error 'Implicit conversion from data type datetime to bigint is not allowed. Use the CONVERT function to run this query. ' Here's my sp and my code which calls the sp.CREATE PROCEDURE spRB_MaxDate (@MaxDate datetime OUTPUT)ASSELECT @MaxDate =MAX(BD_DateRequired)FROM tblRB_BookingDates RETURNGOHere's how I call itDim MySQL1 As String = "spRB_MaxDate" Dim myConn1 As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString")) Dim Cmd1 As New SqlCommand(MySQL1, myConn1) Cmd1.CommandType = CommandType.StoredProcedure 'Add the parameters Dim outParm As SqlParameter = New SqlParameter("@MaxDate", 0) outParm.Direction = ParameterDirection.Output Cmd1.Parameters.Add(outParm) myConn1.Open() Cmd1.ExecuteNonQuery() myConn1.Close() ' ' get value of new id Dim MaxDate As DateTime = Cmd1.Parameters("@MaxDate").Value |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2006-01-05 : 10:38:48
|
| what is the datatype of this column: tblRB_BookingDates.BD_DateRequiredPost an example of one of the values in that column.Be One with the OptimizerTG |
 |
|
|
Pinto
Aged Yak Warrior
590 Posts |
Posted - 2006-01-05 : 10:39:58
|
| I changed the ine to this and it workedDim outParm As SqlParameter = New SqlParameter("@MaxDate", CDate("01/01/06")) |
 |
|
|
|
|
|