|
-
Apr 10th, 2004, 01:39 PM
#1
Thread Starter
Addicted Member
Form with 2 combobox.
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
-
Apr 10th, 2004, 07:15 PM
#2
-
Apr 10th, 2004, 11:36 PM
#3
Thread Starter
Addicted Member
UNRESOLVED
ok ok im not following....
so i need two datasets or i can use one,
cuz with this code it just fill the both combobox with the same data...
-
Apr 11th, 2004, 01:20 AM
#4
if i use dataset to fill my combobox by SQLStatment and i need to fill 2 seperate combos to i need to datasets?
No, you don't need to use two datasets.
What is it you are trying to do? That may clarify what you are really trying to get answered.
-
Apr 11th, 2004, 06:28 AM
#5
Thread Starter
Addicted Member
I have table with phone areas and its ID
all cell phone ares marked with ID 01
and usual phone marked with ID 00
for example cell areas are:
id=01 area=050
id=01 area=053
and phone:
id=00 area=02
id=00 area 03.
on my form i have two combos one must contain cell areas and the other must contain phone areas.
i used the code that i posted on my first messege, and it fill me with cell areas only.
how can i solve it without using two datasets?
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
|