Click to See Complete Forum and Search --> : Dates in SQL Server
André
Oct 28th, 1999, 05:48 PM
Hello there:
I'm new in working with SQL Server from VB, and I'm having a problem I suppose is simple:
I've written a Stored procedure in wich the parameters are a start date and an end date.
In VB I dim these variables as Date and the input is taken from DTPicker controls.
The thig is that somehow I never get the desired records, and I don't get errors either?!?!
I've tried to run it from SQL Server and it works, with the dates being in any format.
But from VB I get zero in return.
Please help
Thanx
André
JorgeLedo
Oct 28th, 1999, 07:28 PM
How are you declaring variables in VB.
Try giving the variables a Variant data type.
------------------
Jorge Ledo
j_ledo@hotmail.com
Portugal
Clunietp
Oct 28th, 1999, 09:01 PM
Try passing your date as "#" & MyDateVariable & "#"
HTH
Tom
JHausmann
Oct 29th, 1999, 11:06 AM
SQL Server expects the dates in a certain format, enclosed in quotes. The "#" delimiter works with Access but not SQL Server.
Post your Stored Procedure, and how you're calling it in VB, and we'll have a look.
Manish
Oct 29th, 1999, 12:21 PM
hi
I have faced a similar problem in my project. this is what I did, I fetch the data from ant control read that data in a variable...and pass that data into a mm/dd/yy format to sql server it works and always gives u the desired results. I declared the variables as string on both the ends at sql server as well as date. what I have analyzed is that u might be setting dtpicker in a specific format which might be diff from the format in which sql server want the date...it might increase the codes but it will give u the desired results in every format.
bcz if your application if going to wrk on diff locations u might face prob when user sets the date in diff fromat for their local system.
feel free to ask if u need any more.
Thanx Manish
André
Oct 31st, 1999, 05:13 PM
Thanx guys for your help, I got it working now, it had something to d owith the output parameter, once I didn't have an output parameter the recordset got back as wished!!
Thanks
André
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.