|
Sorry, this is a forum for asking specific questions. You should be able to find plenty of examples on the internet, if you just google VB.Net ADO demo .
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
In addition to the standard Where operation already provided above, I think you can also use the BETWEEN operator with Access;
Select something From theTable Where theDate Between date1 And date2
|
|
|
|
|
With this code i can filter all the data depending from the supplier.
but i can't filter data between 2 dt pickers
Set ac = New ADODB.Connection
Set ar = New ADODB.Recordset
Call DB
ac.Open strConek
lvSupply.ListItems.Clear
With ar
criteria = "Select *From tblSupply"
.Open criteria, strConek, adOpenStatic, adLockOptimistic
.MoveFirst
Do While Not .EOF
If Mid(!Supplyer, 1, Len(cboSupplyer)) = cboSupplyer Then
Set intitem = lvFurnizimet.ListItems.Add(, , !ID, , 1)
lvSupply.ListItems(lvSupply.ListItems.Count).SubItems(1) = !Date
lvSupply.ListItems(lvSupply.ListItems.Count).SubItems(2) = !Time
lvSupply.ListItems(lvSupply.ListItems.Count).SubItems(3) = !Supplyer
lvSupply.ListItems(lvSupply.ListItems.Count).SubItems(4) = !VTotal
lvSupply.ListItems(lvSupply.ListItems.Count).SubItems(5) = !UserName
End If
.MoveNext
lvSupply.SetFocus
Loop
.Close
End With
Label4.Visible = True
Label5.Visible = True
Label4.Caption = lvSupply.ListItems.Count
Label5.Caption = "Total number of supplyes :"
End Sub
|
|
|
|
|
If you had included this code in your original question you would have received some more usefull answers. Now, why can't you do a select that's limited with two dates?
Are you getting an error, or are you unsure how to adapt the code you already have?
..and why are you using VB6?
Bastard Programmer from Hell
|
|
|
|
|
I'm not getting errors but i can filter only the data from supplier,not by date pickers.
I use VB6 because i find it very easy in use.
thank you for your help.
|
|
|
|
|
BETWEEN probably works fine, however it is unclear to me whether it is including/excluding the boundary values; so I tend not to use it, for clarity's sake.
|
|
|
|
|
It appears to include the opening value and excludes the closing, so i always add a day to the end e.g. if i wanted everything from the 12th to the 15th Jan, i would do;
Between '12/Jan/2011 00:00' And '16/Jan/2011 00:00'
edit: and i always use 3 letter month to avoid confusion with the day
|
|
|
|
|
i want to thank you all for your willing to help me.
i'm confused now what can i do now for filter the dates.
Still i can filter only by supplier.
i appreciate your help and god bless you all.
|
|
|
|
|
All the information has been provided.
Simply append the datepicker date values to the query as per what has been shown above, e.g.
criteria = "Select *From tblSupply Where dateColumnName Between " + datePicker1.value + " AND " + datapicker2.value
You will need to change the dateColumnName and the controlsnames for datepickers and check the datepicker property name for the returned date value, i can't remember for sure of the top of my head if it is called value or not, but i'm sure you can look this up seeing as it is your project!
If you find that the second date value does not catch all the expected results, you might want to add 1 day to this value using DateAdd
|
|
|
|
|
I found this code searching in the net.but even this can't work.i have inserted this code under
txtData1_Click
<pre lang="vb"> Set ac = New ADODB.Connection
Set ar = New ADODB.Recordset
Call DB
ac.Open strConek
With ar
criteria = "Select *From saledetails Where ((Data >= '" & txtData1.Value & "') And (Data <= '" & txtData2.Value & "' ))"
.Open criteria, strConek, adOpenStatic, adLockOptimistic
If .RecordCount > 1 Then
|
|
|
|
|
I don't know what your table column names for the date are? are you sure its Data and not Date?
|
|
|
|
|
|
The other thing I noticed is the source table name has changed from tblSupply in your original question to salesDetails above, are you working with the correct source, your query syntax format is basically correct.
|
|
|
|
|
is tblSupply.this is not the problem...
when i click the dtpicker 1
nothing displays in listview
|
|
|
|
|
Well i don't know where your running code from, are you looking at the change events for the data picker, which should then fire off a query update using the info.
I get hte feeling you are just copy and pasting code without really thinking about what you are trying to achieve. As a result you are getting yourself tied up in knots and confusing the hell out of yourself and me!
|
|
|
|
|
Hello guys,
it seems to be a simple question - but I've been struggling with it so many times and don't find an elegant solution... I want to fill several lists (of FileInfo) once the path in the relevant textboxes has been changed.
I don't want to connect the list generation / update with the 'TextChanged' event of the textbox, since each of the resulting lists consists of a large number of files (approx. 30.000). In that case the lists would be generated / updated with every new key the user enters when typing the path - resulting in a huge loss of performance, I guess.
I can't use the 'Leave' event either, since this would require the user to enter (each of) the textbox(es) to generate / update the lists.
What would be best practice for that everyday 'problem'? As an intermediate solution I use the 'textChanged' event and check first, if the path exists at all.
Thank you for some hints,
Mick
|
|
|
|
|
When dealing with such large results sets where continuous updating isn't responsive, you could;
a) Use a simple submit/go button approach, so only when the user is ready, they initiate the check
b) Run a background worker process, and abort it if a new change event occurs and restart with the new information
I would personally go with option a.
|
|
|
|
|
Thanks for the idea, Dave. Of course, option a is easier - still I like option b better . Actually I want to collect the files automatically while the user sets other options for their processing.
By now, I anyway use the ThreadPool to collect the filelist, but I didn't think about interrupting and re-starting the process.
|
|
|
|
|
|
Sounds like a very good idea - thank you!
|
|
|
|
|
I am wondering to make a parental control like program for Internet Explorer / Mozilla .. Thanks for the reply and help...
|
|
|
|
|
Firstly, there are plenty around already, so why reinvent the wheel... and secondly - why use VB6 for this?
|
|
|
|
|
_Damian S_ wrote: why use VB6 for this anything?
FTFY
|
|
|
|
|
I'm making a security project, but this is the last problem, making a parental control..
|
|
|
|
|
it is unwise to use VB6 for anything, the language is antiquated and obsolete.
|
|
|
|