Hello folks i have this question:
if i use dataset to fill my combobox by SQLStatment and i need to fill 2 seperate combos to i need to datasets?
VB Code:
Dim dsPhoneArea As New DataSet Dim odaPhoneArea As OleDb.OleDbDataAdapter Dim strSql As String = "Select Area FROM tblPhoneAreas where ID = '00'" Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= db.mdb" Try Me.odcFirstContact.ConnectionString = strConn ' MsgBox("tried") Catch eConnection As System.Exception MessageBox.Show(eConnection.Message + " Please contact SQVision team for technical support.", "Database Error", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try '[Change dbconnection to application startup path/] '[Load phone areas into combobox] Try odaPhoneArea = New OleDb.OleDbDataAdapter(strSql, strConn) odaPhoneArea.Fill(dsPhoneArea, "tblPhoneAreas") cmbPhoneArea.DataSource = dsPhoneArea.Tables("tblPhoneAreas") cmbPhoneArea.DisplayMember = "Area" dsPhoneArea.Clear() strSql = "Select Area FROM tblPhoneAreas where ID = '01'" odaPhoneArea = New OleDb.OleDbDataAdapter(strSql, strConn) odaPhoneArea.Fill(dsPhoneArea, "Area") cmbCellArea.DataSource = dsPhoneArea.Tables(0) cmbCellArea.DisplayMember = "Area" end try




Reply With Quote