下面怎么写能够将DATAGRID的RECORDSET设置为rs?
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim str As String
Set cn = New ADODB.Connection
cn.ConnectionString = "provider=sqloledb.1;data source=(local);user id=ss;pwd=ss;initial catalog=sdb"
cn.Open
str = "select * from Users where UserName='" & Trim(Text1.Text) & "'"
Set rs = New ADODB.Recordset
rs.Open str, cn, adOpenStatic, adLockOptimistic
怎么样用语句将DATAGRID与数据库相连?