Error in oledb query

Ronak

Member
Joined
Jan 13, 2006
Messages
11
Programming Experience
1-3
Hello,

I have used this sql statment

Dim Stxt_qty As String = "Select sId,sQty,sDate,sTime from SStock where (sModel ='" & ScmbModel.Text & "') and (sThing='" & ScmbThing.Text & "') and (sSupplier='" & ScmbSupp.Text & "') and (sDate=#" & StxtDate.Value.ToShortDateString & "#)"

It works fine but when become 01/01/2006 (DD/MM/YYYY) OR whenever 'zero' is Prefix before day and month this string does not work means it doesn't access data from database.

NOTE:Query work good when date is 28/12/2006 OR when there is no 'zero' prefix before day and month

Thanks
 
Hi, there was a post like this not long ago, and i'm going to make the same suggestion. String concatenation is just not a good idea in SQL it makes for very undreadable code amongst other things. Have a look at using parameters instead.
 
Hello,

I cldn't understand what u wnat to say.
If i use such query then it will give me error!!

Thanks for reply
 
Back
Top