ms access - Error in getting Dates in database (BETWEEN Clause| VB.NET|OLE) -


Shortly before, I used a code to get between 2 dates from the database (date With column dd / mm / yy), I think it works best for the first time, the code is:

New date in the form of a slow B as a whole (a value) Tx2.Text) b = System.DateTime.Today B = B. Ed. (-a) MSBBC (B) Con. Open () SQLRR = "Choose from TB * where between the last circuit # 01/01/1800 # and #" & amp; B & amp; "#" Dim DataAdapter1 New OleDbDataAdapter (SQLstr, Connecticut) DataSet1.Clear () DataAdapter1.Fill (DataSet1, "Tb") Conn.Close (as in)

As you see , Enter a number to the code user and make it today by making zero, then calculate the date I want, after that I use the pen to get all the dates between them

< P> But now, this code gets some data and overrides others, I mean Some dates are between TWOs, but the code never gets, why does this happen?

If you look at the generated SQL string, then what is your hope on that date? is? I think it would be a database that it is necessary to follow a specific format (either dd / mm / yyyy or mm / dd / yyyy Coded date is given). Could it be that your day and month switch changes when a string version of the date is created and put in your SQL query?

As a side note, if possible, use parameterized queries instead. It may also remove some types of conversion problems.

Update
Here is an example of using a parameterized query on OLE DB for a database:


Comments

Popular posts from this blog

iphone - How do I make a UIPickerView in a UIActionSheet -

java - Is there an object like a "Set" that can contain only unique string values, but also contain a count on the number of occurrences of the string value? -