ADODB.Recordset映射到数据集以绑定.net控件 [英] ADODB.Recordset mapping to dataset to bind .net controls
问题描述
大家好,
我想在VB.net中使用ADODB.Recordset数据绑定.net控件(Datagridview)。好吧,我可以找到一种方法。
我需要将记录集映射到datset,然后将数据集分配给控制的数据源。
到目前为止一直很好,我有成功的结果。下面是相同的代码。
Dim dataAdaObject As New System.Data.OleDb.OleDbDataAdapter()
Dim ds作为新数据集()
dataAdaObject.Fill(ds,stuRecordData,Student)'将记录集映射到数据集对象
DataGridView1.DataSource = ds
现在,我希望处理可能与Datagridview1控件相关的事件,比如说keyup或keydown事件。
问题:
1)对象(datset或记录集),事件应该工作?
2)据我所知,所有事件都必须基于数据集(ds),因为它用于将数据绑定到控件?我在这儿。
请帮助和评论。
问候,
Joy
Hello everyone,
I wanted to use ADODB.Recordset data to bind .net control ( Datagridview) in VB.net. Well, I could find a way to do that.
I need to map recordset to datset and then later assign the dataset to datasource of control.
All is well till now, I have successfull results. Below is the code for the same.
Dim dataAdaObject As New System.Data.OleDb.OleDbDataAdapter()
Dim ds As New DataSet()
dataAdaObject.Fill(ds, stuRecordData, "Student") ' will map recordset to dataset object
DataGridView1.DataSource = ds
Now, I wish to work on events that may be associated with Datagridview1 control, lets say keyup or keydown events.
Questions:
1) On which object (datset or recordset), the events should work?
2) I understand, all events has to be based as per dataset (ds) as that is used to bind data to controls? Am I right here.
Please help and comments.
Regards,
Joy
推荐答案
我很高兴你淘汰VB6。查看这些文章。
为初学者使用ADO.NET [ ^ ]
使用DataGrid控件 [ ^ ]
详细的数据绑定教程 [ ^ ]
I'm glad you panned VB6. Check these articles.
Using ADO.NET for beginners[^]
Using the DataGrid Control[^]
A Detailed Data Binding Tutorial[^]
这篇关于ADODB.Recordset映射到数据集以绑定.net控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!