Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Environment not return same result when stored procedure called

Status
Not open for further replies.

Kflasph

Programmer
Apr 8, 2002
65
US
I am running a stored procedure through my Data Environment in Visual Basic 6.

The first time I call the stored procedure in my program :
DE.Connection1.dbo_mystoredprocedure dateParam1,dateParam2
dateParam1 = '05:00:00 AM'
dateParam2 = '05:00:00 PM'

I get back the results I expect.

Without closing the program, I can run the exact same line of code again:
DE.Connection1.dbo_mystoredprocedure dateParam1,dateParam2
dateParam1 = '05:00:00 AM'
dateParam2 = '05:00:00 PM'

I get no results on the second call.

I can close my program and rerun and it's the same results.
The stored procedure works the first time but not the second.

Does anyone have any ideas as to why this could be happening?


Is there a way to refresh the Data Environment in VB without having to close it and reopen it?
 
Update !

I started looking at my stored procedure and I had a line of code in which I was extracting the time only from the datetime string I was passing.

This is what I was using:
set @sTime = @sDate -Cast(floor(Cast(@sDate as float)) as datetime)

I changed it to :
set @sTime = CONVERT(varchar(7),right(@sDate,7),101)

And now my program works everytime it is called !

I can run the stored procedure all day using the Query Analyzer so it really makes me wonder if it is something in the call to the stored procedure using a Data Environment that did not like the FLOOR extration of the time.

Any comments or similar happenings?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top