object1.New1(False)
object2.New1(False)
object1.FromControl("Listbox1")
object2.Value=obj1.GetProperty("SelectedItems")
a=object2.GetProperty("Count")
For i = 0 To a - 1
Msgbox(obj2.GetProperty2("Item",i))
Next
This Is The Button_Click Event
Here I Want To Check The Selected Datas in Listbox are Exist In Database If Exist I Want To Print Msgbox(itemVariable&"Is Existing")
Can You Help Me?
jothis:sign0085:
I Have A Multi Listbox That Contain Lot of Values Eg:1,2,3,4,5,6 and also I Have A Button Named ChekValues.
if A User Select 1 and 2 and 3. And Clicked The ChekValues.
The Problem Is:
I Want To Check is the all Selected Values existing in the database table or not
Sub Globals
'Declare the global variables here.
End Sub
Sub App_Start
object1.New1(False)
object2.New1(False)
SQLConn.New1 'Connection
SQLDR.New1 'DataReader
SQLConn.Open("Data Source = " & AppPath & "\01.sl3")
SQLComm.New1("", SQLConn.Value) 'Command
object1.FromControl("ListBox1")
object1.SetProperty("SelectionMode","MultiExtended")
Form1.Show
End Sub
Sub ChekValues_Click
object2.Value = object1.GetProperty("SelectedIndices")
SelCount = object2.GetProperty("Count")
For i = 0 To SelCount -1
Look = ListBox1.Item(object2.GetProperty2("Item", i))
SqlComm.CommandText = "SELECT * FROM t_values"
SqlDR.Value = SQLComm.ExecuteReader
Do While SQLDR.ReadNextRow = True
If Look = SQLDR.GetValue(0) Then
Msgbox(Look & " " & "Is Existing In The Table")
Exit
End If
Loop
SqlDr.Close
Next
End Sub
You need to add in your project SQLDesktop.dll and create objects:
Connection as SQLConn
DataReader as SQLDR
Command as SQLComm
Source attached