输入问题?
本人设计一个模块和一个窗体(包含一个treeview)
模块内容为
Option Explicit
Global Conn As New ADODB.Connection
Global usernow As usertype
Type usertype
id As String
type As Integer
End Type
Sub sql1()
Dim strConn As String
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & App.Path & "/1.mdb;Persist Security Info=False "
Conn.CursorLocation = adUseClient
Conn.Open strConn
End Sub
窗体内容为
Public tree2 As New ADODB.Recordset
Public DBt2 As String
public proj0,proj1,proj2,proj3 as node
Private Sub Form_Load()
Call sql1
Set proj0 = TreeView1.Nodes.Add(, , "t0 ", "国际级项目 ")
Set proj1 = TreeView1.Nodes.Add(, , "t1 ", "国家级项目 ")
Set proj2 = TreeView1.Nodes.Add(, , "t2 ", "省、市级项目 ")
Set proj3 = TreeView1.Nodes.Add(, , "t3 ", "企业合作项目 ")
END sub
Private Sub TreeView1_Click()
TreeView1.Nodes(1).Expanded = True
DBt2 = "select * from 项目管理表 where ADD_MAN= ' " & usernow.id & " ' and PROJ_TYPE= '0 ' "
tree2.Open DBt, Conn, adOpenStatic, adLockReadOnly, -1
'上面一行提示标准表达式中数据类型不匹配
MsgBox tree2.Fields( "PROJ_NAME ")
End Sub
请问是什么原因
[解决办法]
public proj0,proj1,proj2,proj3 as node
/*定义变量尽量不要这样定义,指点类型
/*标准表达式中数据类型不匹配
一看SQL语句是否写错了,二对使用到的字段数据类型进行检查。
[解决办法]
public proj0,proj1,proj2,proj3 as node
这个我昨天才碰到过问题~~
除了PROJ3定义成功外,前面几个变量均无类型~~值为空。
dim x,y as integer
x= "xxx " 没错
y= "xxx " 系统报错,类型不匹配。。。。