Set MYNOD = TV1.Nodes.Add(, , "root", "AAA", 1, 2) Set CNRS = New ADODB.Recordset SQL = "select * from GYS_ZL ORDER BY ZLLEV,flm" CNRS.Open SQL, CONN, 1, 1
Do Until CNRS.EOF Set MYNOD = TV1.Nodes.Add(CStr(CNRS!上级类), 4, CNRS!本级类, CNRS!编码 & " " & CNRS!名称, 1, 2) CNRS.MoveNext Loop CNRS.Close Set CNRS = Nothing
TV1.Nodes(1).Expanded = True
在调用数据库的时候我 cn.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=ywc;Data Source=CH" cn.Open Dim roottree As String roottree = Text1.Text rss.Source = "select hcode from tree where code=" + roottree rss.Open 怎么会出错?说是找不到列名。请告诉我该怎么写好
rss.Source = "select hcode from tree where code='"& roottree & "'"
TV1.Nodes.Clear
Set MYNOD = TV1.Nodes.Add(, , "root", "AAA", 1, 2)
Set CNRS = New ADODB.Recordset
SQL = "select * from GYS_ZL ORDER BY ZLLEV,flm"
CNRS.Open SQL, CONN, 1, 1
Do Until CNRS.EOF
Set MYNOD = TV1.Nodes.Add(CStr(CNRS!上级类), 4, CNRS!本级类, CNRS!编码 & " " & CNRS!名称, 1, 2)
CNRS.MoveNext
Loop
CNRS.Close
Set CNRS = Nothing
TV1.Nodes(1).Expanded = True
cn.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=ywc;Data Source=CH"
cn.Open
Dim roottree As String
roottree = Text1.Text
rss.Source = "select hcode from tree where code=" + roottree
rss.Open 怎么会出错?说是找不到列名。请告诉我该怎么写好