为什么VB6 TDBGRID绑定老是没有数据呢?
我是新手。在做一个VB6网格绑定代码如下,网格对象那边字段有些(DataFiled)。adodata 对象为ADODC那个分页的东西
程序代码:
Dim ado_reset As New ADODB.Recordset Public Sub Form_Load()[local]1[/local] Dim fos As New FileSystemObject Dim xmlDoc As New DOMDocument Dim xmlName As IXMLDOMElement Dim xmlAge As IXMLDOMElement Dim xmlSex As IXMLDOMElement Dim xmlInfo As IXMLDOMElement Dim xmlRoot As IXMLDOMNode Dim xmlSelectInfo As IXMLDOMNodeList InitGrid CreateData ado_reset.AddNew ado_reset.Fields("number").Value = "1" ado_reset.Fields("age").Value = 16 ado_reset.Fields("name").Value = "1" ado_reset.Fields("sex").Value = 1 ado_reset.Update Set adodata.Recordset = ado_reset 'gridInfo.Recordset = ado_reset End Sub Private Sub InitGrid() With gridInfo Set .DataSource = adodata .SelectedBackColor = g_clrSelectedBack .SelectedForeColor = g_clrSelectedFore End With End Sub '创建手动数据集 Private Sub CreateData() Set ado_reset = New ADODB.Recordset ado_reset.CursorType = adOpenDynamiRecordsetc ado_reset.LockType = adLockOptimistic ado_reset.CursorLocation = adUseClient ado_reset.Fields.Append "number", adChar, 2 ado_reset.Fields.Append "age", adChar, 4 ado_reset.Fields.Append "name", adVarChar, 6 ado_reset.Fields.Append "sex", adVarChar, 4 ado_reset.Open End Sub
不知道为什么界面一直没有数据
[ 本帖最后由 ysq5202121 于 2013-12-18 15:11 编辑 ]