win cc指教 ,提示NO NAME1,NAME2 等变量没有对象 点击:826 | 回复:0



qfcctpp

    
  • 精华:0帖
  • 求助:0帖
  • 帖子:2帖 | 8回
  • 年度积分:0
  • 历史总积分:17
  • 注册:2006年5月24日
发表于:2006-07-25 16:53:00
楼主
Dim strcn,cn
Dim strSQL
Dim NUM,DB1_DBW1,DB1_DBW2,DB1_DBW3,DB1_DBW4,DB1_DBW5,DB1_DBW6,DB1_DBW7,DB1_DBW8,DB1_DBW9,DB1_DBW10
strcn = "PROVIDER=MSDASQL;dsn=sqlserver;uid=;pwd=;database=FJDB;"
Set cn = CreateObject("ADODB.Connection")
cn.ConnectionString = strcn
cn.Open
NUM = HMIRuntime.Tags("NUM").Read
DB1_DBW1 = HMIRuntime.Tags("DB1_DBW1").Read
DB1_DBW2 = HMIRuntime.Tags("DB1_DBW2").Read
DB1_DBW3 = HMIRuntime.Tags("DB1_DBW3").Read
DB1_DBW4 = HMIRuntime.Tags("DB1_DBW4").Read
DB1_DBW5 = HMIRuntime.Tags("DB1_DBW5").Read
DB1_DBW6 = HMIRuntime.Tags("DB1_DBW6").Read
DB1_DBW7 = HMIRuntime.Tags("DB1_DBW7").Read
DB1_DBW8 = HMIRuntime.Tags("DB1_DBW8").Read
DB1_DBW9 = HMIRuntime.Tags("DB1_DBW9").Read
DB1_DBW10 = HMIRuntime.Tags("DB1_DBW10").Read
strSQL = "select NO,NAME1,NAME2,NAME3,NAME4,NAME5,NAME6,NAME7,NAME8,NAME9,NAME10 from FJTB where(NO = 1)"
cn.Execute strSQL
cn.close
NUM = NO
DB1_DBW1 = NAME1
DB1_DBW2 = NAME2
DB1_DBW3 = NAME3
DB1_DBW4 = NAME4
DB1_DBW5 = NAME5
DB1_DBW6 = NAME6
DB1_DBW7 = NAME7
DB1_DBW8 = NAME8
DB1_DBW9 = NAME9
DB1_DBW10 = NAME10

HMIRuntime.Tags("NUM").Write NUM
HMIRuntime.Tags("DB1_DBW1").Write DB1_DBW1 
HMIRuntime.Tags("DB1_DBW2").Write DB1_DBW2 
HMIRuntime.Tags("DB1_DBW3").Write DB1_DBW3 
HMIRuntime.Tags("DB1_DBW4").Write DB1_DBW4 
HMIRuntime.Tags("DB1_DBW5").Write DB1_DBW5 
HMIRuntime.Tags("DB1_DBW6").Write DB1_DBW6 
HMIRuntime.Tags("DB1_DBW7").Write DB1_DBW7 
HMIRuntime.Tags("DB1_DBW8").Write DB1_DBW8 
HMIRuntime.Tags("DB1_DBW9").Write DB1_DBW9 
HMIRuntime.Tags("DB1_DBW10").Write DB1_DBW10 


热门招聘
相关主题

官方公众号

智造工程师