Welcome to Dream.In.Code
Become a VB Expert!

Join 149,966 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,361 people online right now. Registration is fast and FREE... Join Now!




search database with listbox.selecteditem

 
Reply to this topicStart new topic

search database with listbox.selecteditem

oldgolfer
29 Dec, 2007 - 01:20 AM
Post #1

New D.I.C Head
*

Joined: 13 Nov, 2006
Posts: 20



Thanked: 1 times
My Contributions
My problem is I can search database for rows matching date column with this code:-
CODE
drCurrent2 = HunterPlayerdatabaseDataSet.Dates.Select("DateofGame = '" & DateTimePicker1.Text & "'")

but I want to use a listbox which is filled from a database which is filled from DateTimePicker I tried this code but cannot get it to work
CODE
drCurrent = HunterPlayerdatabaseDataSet.GameStats.Select("GameDate = '" & ListBox1.SelectedItem & "'")
Thx
User is offlineProfile CardPM
+Quote Post

oldgolfer
RE: Search Database With Listbox.selecteditem
29 Dec, 2007 - 05:20 PM
Post #2

New D.I.C Head
*

Joined: 13 Nov, 2006
Posts: 20



Thanked: 1 times
My Contributions
QUOTE(oldgolfer @ 29 Dec, 2007 - 02:20 AM) *

My problem is I can search database for rows matching date column with this code:-
CODE
drCurrent = HunterPlayerdatabaseDataSet.Dates.Select("DateofGame = '" & DateTimePicker1.Text & "'")

but I want to use a listbox which is filled from a database which is filled from DateTimePicker I tried this code but cannot get it to work
CODE
drCurrent = HunterPlayerdatabaseDataSet.GameStats.Select("GameDate = '" & ListBox1.SelectedItem & "'")
Thx

Think I have solved my own Prob.
CODE
drCurrent = HunterPlayerdatabaseDataSet.Dates.Select("DateofGame = '" & ListBox1.SelectedItem.Item("DateofGame").ToString & "'")

Where "DateofGame" is column name in database biggrin.gif thx anyway
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 06:21PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month