ADODB.RecordSet and Combobox's

I have the following code to create a record set in a form

Dim db As New ADODB.Connection
Dim dbConString As String = "Provider=sqloledb;server=sql1;uid=itregister;pwd=%T6y7u8i9o;database=itregister"
db.Open(dbConString)

Dim rsCompany As New ADODB.Recordset
rsCompany.Open("SELECT * FROM Company", db)


I want to set the properties of a combobox using this recordset. I have used the following code

comboboxCompany.ValueMember = rsCompany.Fields("CompanyRef").Value
comboboxCompany.DisplayMember = rsCompany.Fields("CompanyName").Value

When i testand i click the dropdown arrow on the combobox nothing happens. I am new to using ADODB i have always used tableadapters. What am i doing wrong?

LVL 1
ict-torquilclarkAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ict-torquilclarkAuthor Commented:
This code is in the Form load even
0
indianguru2Commented:
Add this too

comboboxCompany.DataSource = rsCompany
0
ict-torquilclarkAuthor Commented:
I did try that but i got the following error

Complex DataBinding accepts as a data source either an IList or an IListSource
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

indianguru2Commented:
comboboxCompany.DataSource = rsCompany.Tables(0)
0
ict-torquilclarkAuthor Commented:
Now i get

Public member 'tables' on type 'RecordSetClass' not found
0
Alfred A.Commented:
Just a suggestion, why don't you convert your RecordSet into a Dataset and then use this DataSet as your data source, so that you would not get the IList/IListSource issue.

Check this out:

http://msdn.microsoft.com/en-us/library/aa720078%28VS.71%29.aspx

I hope this helps.
0
Carl TawnSystems and Integration DeveloperCommented:
This might be a daft question, but if you've been using TableAdapters before, why are you now taking a step back and using ADODB?
0
Alfred A.Commented:
Yeah.  I agree with @carl_tawn.  Why are you still using ADODB when there are other powerful data access tools available in .NET and since you are using TableAdapters already?
0
ict-torquilclarkAuthor Commented:
I was using it because for some reason VS2008 was loading ever tableadapter that i used in my project into the project toolbar - this was seriousley slowing down the loading time for a form when trying to open it in VS.

I found a fix for this and have therefore gone back to using table adapters...

Tools > Options > Windows Form Designer> General > Auto Toolbar Populate = FALSE
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CodeCruiserCommented:
Is the problem sorted?
0
ict-torquilclarkAuthor Commented:
Yes
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.