回复:wincc的dbgrid控件

小建子

  • 帖子

    29
  • 精华

    0
  • 被关注

    1

论坛等级:游民

注册时间:2015-02-17

普通 普通 如何晋级?

发布于 2015-05-01 15:35:59

13楼

Dim sSql
Dim oRs
Dim conn
Dim oCom
Dim Con
Dim m

Con="Driver={SQL Server};Server=USER-20150401YP\SQL2005;uid=sa;pwd=sa123;database=yejian"

Set conn=CreateObject("ADODB.Connection")

conn.ConnectionString=Con

conn.CursorLocation=3

conn.Open

sSql="SELECT * FROM INDIV_INFO "

Set oRs=CreateObject("ADODB.Recordset")

Set oCom=CreateObject("ADODB.Command")

Set oCom.ActiveConnection=conn

oCom.CommandType=1

oCom.CommandText=sSql

Set oRs=oCom.Execute

m=oRs.RecordCount

MsgBox m

Dim Grid

Set Grid=ScreenItems("控件1")
MsgBox("3")
'Set Grid.DataSource = objRecordset.Recordset
Set Grid.DataSource = oRs
MsgBox("4")
Grid.Refresh

Set objRecordset = Nothing

objConnection.Close

Set objConnection = Nothing


已经能查到数据表有11条记录,但是加载到dbgrid控件的脚本还有问题,Dim Grid

Set Grid=ScreenItems("控件1")
MsgBox("3")
'Set Grid.DataSource = objRecordset.Recordset
Set Grid.DataSource = oRs
MsgBox("4")
Grid.Refresh
两位斑竹有没有更好的方法实现数据的绑定呀,求指导
评论
编辑推荐: 关闭

请填写推广理由:

本版热门话题

SIMATIC WinCC / Panel

共有32659条技术帖

相关推荐

热门标签

相关帖子推荐

guzhang

恭喜,你发布的帖子

评为精华帖!

快扫描右侧二维码晒一晒吧!

再发帖或跟帖交流2条,就能晋升VIP啦!开启更多专属权限!

  • 分享

  • 只看
    楼主

top
X 图片
您收到0封站内信:
×
×
信息提示
很抱歉!您所访问的页面不存在,或网址发生了变化,请稍后再试。