public conn as new adodb.Connection
public reco as new adodb.recordset
public connstring,commandstring as string
with conn
.connectionstring=connstring
.open
end with
with reco
.ActiveConnection = Conn
.LockType = adLockOptimistic
.CursorType = adOpenDynamic
.Source = Commandstring
.Open
end with
with dbgrid1 //这是表格控件
.ClearFields
.ClearSelCols
.Refresh
.DataSource = Reco //在运行的时候程序向我报出了“无此数据成员的错”
.Refresh
End With
.DataSource = Reco.Recordset.DataSource搞定!!!
set reco = new ADODC.Recordset试一下在过程中加入如上两句
connstring 该字符串有没有定义了SQL语句?如 connstring="select * from tablename"with dbgrid1 //这是表格控件
.ClearFields
.ClearSelCols
.Refresh
.DataSource = Reco **换成set .DataSource = Reco
.Refresh
End Withwith reco
.ActiveConnection = Conn
.LockType = adLockOptimistic
.CursorType = adOpenDynamic
.Source = Commandstring **换成 set .Source = Commandstring
.Open
end with