|
-
Apr 11th, 2004, 05:09 AM
#1
Thread Starter
Lively Member
urgent please help me !!!
i got a problem to add a data to my checkedlistbox the command is like that
==============================================
Try
conn.Open()
Dim sql = "SELECT * FROM CustomerBooking WHERE cday='" & Me.day.Text & "' And cmonth='" & Me.month.Text & "' And carrivetime='" & Me.carrivetime.Text & "' And cyear ='" & Me.year.Text & "'"
cmd = New OleDbCommand(sql, conn)
Dim dr As OleDbDataReader = cmd.ExecuteReader
While dr.Read
Num1 = dr("tablenumber")
Me.CheckedListBox1.Items.Add(Num1)
End While
dr.Close()
conn.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
==============================================
y the result given to me is a duplicate one ??
example i have 1,2,3 inside my database
and the checkedlistbox result is 1,2,3,1,2,3 double time
wat is the problem ?
please help
-
Apr 11th, 2004, 07:31 AM
#2
Hi.
I don't now much about SQL but I think the problem lies elsewhere.
I noticed that you do not clear the items in the list before adding.
So if, for some reason, you function gets called twice it will add them again.
You can check for this very easily by adding a messagebox on the beginning of the function. Then you can see if that msg comes up twice.
But I would recommend clearing the items in the list before adding anyway.
Hope this helps.
I wish I could think of something witty to put in my sig...
...Currently using VS2013...
-
Apr 11th, 2004, 11:16 AM
#3
Frenzied Member
You'll have to do a DISTINCT query
Code:
SELECT DISTINCT tableNumber FROM etc...
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
Apr 11th, 2004, 11:56 AM
#4
Thread Starter
Lively Member
Thank You I solve the problem already
thanx for helping me
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|