Click here to Skip to main content
15,887,267 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Help section inside a small app.. Pin
Tarakeshwar Reddy26-Apr-11 9:27
professionalTarakeshwar Reddy26-Apr-11 9:27 
GeneralRe: Help section inside a small app.. Pin
waner michaud26-Apr-11 9:53
waner michaud26-Apr-11 9:53 
AnswerRe: Help section inside a small app.. Pin
Tarakeshwar Reddy26-Apr-11 10:15
professionalTarakeshwar Reddy26-Apr-11 10:15 
QuestionSearching in Database between 2 dates. Pin
Kurdy8626-Apr-11 3:46
Kurdy8626-Apr-11 3:46 
AnswerRe: Searching in Database between 2 dates. Pin
Dave Kreskowiak26-Apr-11 4:08
mveDave Kreskowiak26-Apr-11 4:08 
GeneralRe: Searching in Database between 2 dates. Pin
Kurdy8626-Apr-11 4:23
Kurdy8626-Apr-11 4:23 
GeneralRe: Searching in Database between 2 dates. Pin
Dave Kreskowiak26-Apr-11 4:53
mveDave Kreskowiak26-Apr-11 4:53 
AnswerRe: Searching in Database between 2 dates. [modified] Pin
Luc Pattyn26-Apr-11 4:13
sitebuilderLuc Pattyn26-Apr-11 4:13 
Kurdy86 wrote:
Its working but like i said, my results are not the one that i want.

You have a special concept of "working" then. Big Grin | :-D

Here are some comments:

1.
you didn't provide some essential information, such as what database you are using, what the field types are, etc.

2.
if (I can't tell) you were to store dates as strings, that would not be smart as it makes things overly complex; a date in string format depends on culture. The general advice is to use the most specialized field type that matches your purpose.

3.
Your SQL statement is using whatever the user types in some TextBoxes; that is very dangerous. Read up on SQL Injection attacks, then start doing it the proper way:
- get the user data from the TextBoxes into properly typed variables (using SomeType.TryParse), which forces you to validate the input;
- construct an SQLCommand and use SQLParameter instances to provide variable data, such as the begin and end date.

It takes some more code than you have right now, however it is safe and won't suffer from regional settings problems which you may have right now.

[ADDED]
4.
As others have pointed out, you probably can't just have an OR operator in a complex WHERE clause without some parentheses; when in doubt, or just to make things absolutely clear, add parentheses and format your SQL statement so it reads more easily.
[/ADDED]

Smile | :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

modified on Tuesday, April 26, 2011 11:11 AM

GeneralRe: Searching in Database between 2 dates. Pin
Kurdy8626-Apr-11 4:26
Kurdy8626-Apr-11 4:26 
GeneralRe: Searching in Database between 2 dates. Pin
Kurdy8627-Apr-11 2:10
Kurdy8627-Apr-11 2:10 
AnswerRe: Searching in Database between 2 dates. Pin
Eddy Vluggen26-Apr-11 4:50
professionalEddy Vluggen26-Apr-11 4:50 
AnswerRe: Searching in Database between 2 dates. Pin
Tim Carmichael26-Apr-11 5:10
Tim Carmichael26-Apr-11 5:10 
AnswerRe: Searching in Database between 2 dates. Pin
Kurdy8627-Apr-11 2:05
Kurdy8627-Apr-11 2:05 
AnswerRe: Searching in Database between 2 dates. [modified] Pin
Luc Pattyn27-Apr-11 2:50
sitebuilderLuc Pattyn27-Apr-11 2:50 
GeneralRe: Searching in Database between 2 dates. Pin
Kurdy8627-Apr-11 23:34
Kurdy8627-Apr-11 23:34 
Questionsuperscript Pin
M.Kol25-Apr-11 10:58
M.Kol25-Apr-11 10:58 
AnswerRe: superscript Pin
thatraja26-Apr-11 5:41
professionalthatraja26-Apr-11 5:41 
GeneralRe: superscript Pin
M.Kol27-Apr-11 12:41
M.Kol27-Apr-11 12:41 
QuestionDrawin line graph in VB6 by using a picture box? Pin
Dino-ETF24-Apr-11 3:30
Dino-ETF24-Apr-11 3:30 
AnswerRe: Drawin line graph in VB6 by using a picture box? Pin
thatraja24-Apr-11 18:24
professionalthatraja24-Apr-11 18:24 
Questionpassing parameter to run method at msscriptcontrol Pin
aphei22-Apr-11 17:09
aphei22-Apr-11 17:09 
AnswerRe: passing parameter to run method at msscriptcontrol Pin
Eddy Vluggen23-Apr-11 2:18
professionalEddy Vluggen23-Apr-11 2:18 
GeneralRe: passing parameter to run method at msscriptcontrol Pin
aphei24-Apr-11 15:39
aphei24-Apr-11 15:39 
GeneralRe: passing parameter to run method at msscriptcontrol Pin
Eddy Vluggen25-Apr-11 0:07
professionalEddy Vluggen25-Apr-11 0:07 
QuestionHow to determine what in application causes UAC to be trigger in Windows 7 SP 1? Pin
Jon_Boy22-Apr-11 4:55
Jon_Boy22-Apr-11 4:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.