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 |
|
Duleep_N
Starting Member
2 Posts |
Posted - 2004-09-16 : 13:40:58
|
| Hi guys;I am developing a ASP.NET application with sql database.I am trying to pass a sessionID as aparameter to a stored Procedure.HERE IS THE SRORED PROCEDURECREATE procedure sp_RetrieveEventsByDay@DateInput datetime,@EmpID NVarCharasselect * from tblEventswhere( (@DateInput between eventstartdate and eventenddate)or (@DateInput between recurrencestart and recurrenceend)or (@DateInput >= recurrencestart and recurrenceend Is Null) ) and Colleague_CartNumber=@EmpIDOrder By EventStartTimeGOColleague_CartNumber is a NVarChar field in the databaseInstead of the above procedure if i say....CREATE procedure sp_RetrieveEventsByDay@DateInput datetime,@EmpID NVarCharasselect * from tblEventswhere( (@DateInput between eventstartdate and eventenddate)or (@DateInput between recurrencestart and recurrenceend)or (@DateInput >= recurrencestart and recurrenceend Is Null) ) and Colleague_CartNumber='M922'Order By EventStartTimeGOit works......i check the coding of the programme and it execute the stored procedure....Where do i go wronghere is the asp.net code if its any help Dim objCmd As New SqlCommand("sp_RetrieveEventsByDay", mySqlConnection) objCmd.CommandType = CommandType.StoredProcedure Dim ParamdteCurrent As SqlParameter = New SqlParameter("@DateInput", SqlDbType.DateTime, 8) ParamdteCurrent.Value = dteCurrent.ToShortDateString objCmd.Parameters.Add(ParamdteCurrent) Dim ParamEmpID As SqlParameter = New SqlParameter("@EmpID", SqlDbType.NVarChar, 50) ParamEmpID.Value = Session("EmpID") objCmd.Parameters.Add(ParamEmpID) 'Try mySqlConnection.Open() DR = objCmd.ExecuteReader()CAN ANYBODY PLEASE HELP...... |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2004-09-16 : 13:59:13
|
try:ParamEmpID.Value = Session("EmpID").ToString()edit:fix the bold part tooCREATE procedure sp_RetrieveEventsByDay@DateInput datetime,@EmpID NVarChar(50)Go with the flow & have fun! Else fight the flow |
 |
|
|
Duleep_N
Starting Member
2 Posts |
Posted - 2004-09-16 : 15:59:46
|
| ThanksIt works |
 |
|
|
|
|
|