MSFlexGrid 与数据库相连??
连接如下:
.ConnectionString = "provider=sqloledb.1;"
& "DATABASE=VWB_DATA;SERVER=SEI_PC_8;UID=sa;PWD=;"
.Open
Set rsRet = New Recordset
用MSFlexGrid怎样与数据源连接
想用代码连接,不用数据控件棒定. 用什么方法?怎样做?请写具体些,俺比较菜的.
如果实在不行,用其他控件行不行? 具体! 具体! 具体!
库名:vwb-data 表名:usetest 项:useid usepwd usesfen
问题点数:50、回复次数:3Top
1 楼zzh()回复于 2000-11-08 12:46:00 得分 10
使用代码连接时可以声明一个ADO对象,然后再打开该对象,在成功的取得数据库,
用如下语句就可以:
Dim rst as ADO.Recordset
rst.Open""
set MSHFlexGrid1.DataSoruce=rst
Top
2 楼pop133()回复于 2000-11-09 03:27:00 得分 40
用代码实现是个好主意:如下
dim conn as new adodb.connection,rs as adodb.recordset
On Error Resume Next
Conn.Open Connstr$
Ssql$ = "select useid,usepwd,usesfen from usetest"
Rs.Open Ssql$, Conn, adOpenForwardOnly, adLockReadOnly
If Err.Number <> 0 Then MsgBox Err.Description, vbOKOnly + vbExclamation, "error:about": End
With MSFlexGrid1
If Rs.EOF Then .Rows = 3
While Not Rs.EOF
.Col = 1: .Text = Rs("useid") & ""
.Col = 2: .Text = Rs("usepwd") & ""
.Col = 3: .Text = Rs("usesfen") & ""
.Rows = .Rows + 1
.Row = .Row + 1
Rs.MoveNext
Wend
.Rows = .Rows - 1
End WithTop
3 楼insert()回复于 2000-11-09 15:36:00 得分 0
let me test . and you will earn your point . thanks a lot!!!
2 man dou you.
qiu to ma te!
Top




