如何用VB访问Wincc数据库
1个回答
展开全部
sPro = "Provider=sqloledb.1;integrated security=sspi persist security info=false;" sDsn = "initial catalog=数据库名;" sSer = "Data Source=计算机名.\WinCC;" sCon = sPro + sDsn + sSer
sSql= "select * from 数据库名"
Set conn = CreateObject("ADODB.Connection") conn.ConnectionString = sCon conn.CursorLocation = 3 conn.Open
Set oRs = CreateObject("ADODB.Recordset") Set oCom = CreateObject("ADODB.Command") oCom.CommandType = 1
Set oCom.ActiveConnection = conn oCom.CommandText = ssql Set oRs = oCom.Execute
sSql= "select * from 数据库名"
Set conn = CreateObject("ADODB.Connection") conn.ConnectionString = sCon conn.CursorLocation = 3 conn.Open
Set oRs = CreateObject("ADODB.Recordset") Set oCom = CreateObject("ADODB.Command") oCom.CommandType = 1
Set oCom.ActiveConnection = conn oCom.CommandText = ssql Set oRs = oCom.Execute
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询