08-08-20, 11:47 PM
(08-08-20, 11:39 PM)عمور2016 كتب :PHP كود :
Dim query As String
Dim command As OleDbCommand
Dim reader As OleDbDataReader
'فحص الاتصال بقاعدة البيانات
If con.State = ConnectionState.Closed Then
con.Open()
End If
query = "SELECT dep_name FROM [department]"
command = New OleDbCommand(query, con)
reader = command.ExecuteReader()
If reader.HasRows Then
While reader.Read()
ComboBox1.Items.Add(reader(0))
'Label2.Text = "تمت الاضافة"
End While
End If
reader.Close()
con.Close()
هذا الكود يشمل الكومبو فقط والليست بوكس
شوف اي كود من عندك
المتغير buttons هو المصفوفه
PHP كود :
dim buttons as button()={button1,button2,button3}
Dim query As String
Dim command As OleDbCommand
Dim reader As OleDbDataReader
'فحص الاتصال بقاعدة البيانات
If con.State = ConnectionState.Closed Then
con.Open()
End If
query = "SELECT dep_name FROM [department]"
command = New OleDbCommand(query, con)
reader = command.ExecuteReader()
If reader.HasRows Then
dim i=0
While reader.Read()
'ComboBox1.Items.Add(reader(0))
'Label2.Text = "تمت الاضافة"
buttons(i).text=reader(0)
i=i+1
if i=buttons.count then exit while
End While
End If
reader.Close()
con.Close()
