Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 190371 - Last Review: March 2, 2005 - Revision: 2.3
HOWTO: Use Bound Controls with an ADO Recordset
This article was previously published under Q190371
If you want to use a bound ListBox, ComboBox, or Grid control with an
ActiveX Data Objects (ADO) recordset, then use the DataList, DataCombo, or
DataGrid control instead of the DBList, DBCombo, or DBGrid control. If you
try to use DBList, DBCombo, or DBGrid, you get the following error message
when trying to set the RowSource for either the DBList or the DBCombo, or
the DataSource for the DBGrid:
No Compatible DataSource was found for this control. Please add
an intrinsic DataControl or a Remote DataControl to the form.
The complex binding that ADO and the ADO Data Control use is IRowset based,
but the complex binding behavior that the DBList, DBCombo, and DBGrid use
is ICursor-based.
The following example uses the ADO Data Control to create the ADO
recordset.
Steps to Reproduce Behavior
- Open a Standard EXE project in Visual Basic.
- Click Components on the Project menu and select the following:
Microsoft ADO Data Control 6.0
Microsoft Data Bound List Controls 6.0
Microsoft DataList Controls 6.0 (OLEDB)
- Add an ADO Data Control to the form.
- Set the following properties on the ADO Data Control:
ConnectionString: dsn=<yourdsn>
-or-
Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;
Initial Catalog=pubs;Data Source=<yourserver>
- To create each of the preceding samples, click the ellipsis (...) and complete the dialog boxes:
RecordSource: select * from authors
- Add a DBList and a DataList control to the form.
- Set the following properties on the DataList control:
RowSource: ADODC1
Listfield: au_lname
- Run the form and the DataList displays a list of names.
- Set the RowSource property of the DBList and the error message appears.
APPLIES TO
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
- Microsoft Data Access Components 2.5
- Microsoft Data Access Components 2.6
- Microsoft Data Access Components 2.7
| kbcode kbctrl kberrmsg kbhowto KB190371 |
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate
Be the first to leave feedback, to help others about this knowledge base
article.
(Optional) Name
(Optional)
Public URL Or Email
Comments
No
HTML -- Text Only Please