如何为msdatagrid控件动态绑定数据源?
问题点数:15、回复次数:12Top
1 楼wyzegg(蛋)回复于 2001-11-07 21:20:24 得分 5
使用一个ADODC和msdatagrid绑定
然后生成一个变量m_adodc
用m_adodc.SetConnectionString
m_adodc.SetReccordSource
m_sdodc.Refresh
就OK啦
Top
2 楼fajili(阿良)回复于 2001-11-07 21:23:06 得分 0
有谁知道,请告诉我,这里先谢谢了。Top
3 楼fajili(阿良)回复于 2001-11-07 21:27:41 得分 0
我生成m_adodc变量后,调试通过,但一run就出错。
我现在想知道不用ADODC如何绑定?Top
4 楼fajili(阿良)回复于 2001-11-07 21:56:43 得分 0
接上。出错具体情况如下:
用m_adodc变量移动记录时出现调试错误,我使用的语句为:
m_adodc.getrecordset().movelast()
如果不对,该如何移动记录呢?请指教。Top
5 楼jiangsheng(蒋晟.Net[MVP])回复于 2001-11-08 21:42:51 得分 0
move之前看看是否IsEOFTop
6 楼fajili(阿良)回复于 2001-11-08 22:00:01 得分 0
在第一条记录处开始执行也出现错误,应该不是这个原因。记录总数在一条以上。Top
7 楼jiangsheng(蒋晟.Net[MVP])回复于 2001-11-08 22:06:46 得分 10
http://download.microsoft.com/download/vc60pro/Utility/1.0/W9X/EN-US/Mfceqado.exe
SAMPLE: Mfceqado.exe Shows How to Use English Query with MFC and ADO
ID: Q229612
--------------------------------------------------------------------------------
The information in this article applies to:
Microsoft Visual C++, 32-bit Editions, version 6.0
Microsoft English Query, version 7.0
ActiveX Data Objects (ADO), versions 2.1, 2.5
--------------------------------------------------------------------------------
SUMMARY
Mfceqado.exe is an English Query ADO Visual C++ sample that uses ADO in a Visual C++ MFC application to query SQL Server statements generated by the English Query engine. The sample uses DataGrid Control version 6.0 (OLEDB) to display the results.
Top
8 楼fajili(阿良)回复于 2001-11-08 22:39:13 得分 0
to jiangsheng:
你的原码已下载,但编译出错,少库文件。
fatal error C1083: Cannot open type library file: 'e:\Program Files\Common Files\System\EQ\mseqole.dll': No such file or directoryTop
9 楼jiangsheng(蒋晟.Net[MVP])回复于 2001-11-08 22:43:34 得分 0
The English Query code used in this sample is very similar to the MFCUI C++ Remote Data Objects (RDO) English Query sample that ships with the SQL Server 7.0 CD-ROM.
Refer to the following Microsoft Knowledge Base article for more information on how to use DataGrid Control with ADO in Visual C++:
Q229029 SAMPLE: AdoDataGrid.exe Demonstrates Using ADO with DataGrid
Steps to Run Sample
Build and run Mfcequi.exe.
Specify an English Query (EQ) application (.eqc) file and a question (.eqq) file in the Welcome dialog box. You can use either the Pubs.eqc or NorthWind.eqc sample EQ files that are installed by EQ in the samples folder.
Click Start Application in the Welcome dialog box.
Choose a SQL Server 7.0 data source in the ODBC Administrator dialog box that displays when you click Start Application.
Enter an English sentence to query into the main query dialog box. For example, enter the following query for the pubs database if you select Pubs.eqc in step 2:
How many authors live in Oakland ?
Click Submit to run the query. The English Query parses the English statment to generate SQL language. The application uses ADO to submit the SQL statement to SQL Server. The DataGrid displays the results. Click Show SQL to see SQL language command sent to SQL Server.
Top
10 楼cft007(振翅欲飞)回复于 2001-12-11 22:13:41 得分 0
我使用msflexgrid控件绑定数据库的,原码你要不要????Top
11 楼woowindicevc(vcvc2vc)回复于 2001-12-11 22:29:00 得分 0
要!!!fcw2001@hzcnc.comTop
12 楼fajili(阿良)回复于 2001-12-11 22:31:26 得分 0
我要,先谢了!fjl1977@163.comTop




