waleed
04-15-2009, 07:16 PM
hii all
i get a problem here...
i'm working on a scada system , & i'm using a vbscript in it .
i built a script to collect data from some outer device called "PLC" in a data recordset
& this massage appeared to me when i run the program "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"..
and this is the code to make a data recordset for the tow items "volt(v) & current (i)"
the script:
Dim objConnection
Dim strConnectionString
Dim strSQL
Dim objCommand
Dim objRecordset
Dim v,i,t
v=SmartTags("InstV")
i=SmartTags("InstI")
t=SmartTags("time")
Set objConnection = CreateObject("ADODB.Connection")
objConnection.ConnectionString = "Provider=MSDASQL;DSN=voltage;UID=;PWD=;"
objConnection.Open
Set objCommand = CreateObject("ADODB.Command")
Set objRecordset = CreateObject("ADODB.Recordset")
objCommand.CommandType = 1 ' 1=adCmdText
Set objCommand.ActiveConnection = objConnection
objCommand.CommandText = "insert into Voltage (t,v) VALUES ("&t&","&v&")"
Set objRecordset = objCommand.Execute
objConnection.Close
Set objCommand = Nothing
Set objConnection = Nothing
Set objConnection = CreateObject("ADODB.Connection")
objConnection.ConnectionString = "Provider=MSDASQL;DSN=currnt;UID=;PWD=;"
objConnection.Open
Set objCommand = CreateObject("ADODB.Command")
Set objRecordset = CreateObject("ADODB.Recordset")
objCommand.CommandType = 1 ' 1=adCmdText
Set objCommand.ActiveConnection = objConnection
objCommand.CommandText = "insert into current (t,i) VALUES ("&t&","&i&")"
Set objRecordset = objCommand.Execute
objConnection.Close
Set objCommand = Nothing
Set objConnection = Nothing
i get a problem here...
i'm working on a scada system , & i'm using a vbscript in it .
i built a script to collect data from some outer device called "PLC" in a data recordset
& this massage appeared to me when i run the program "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"..
and this is the code to make a data recordset for the tow items "volt(v) & current (i)"
the script:
Dim objConnection
Dim strConnectionString
Dim strSQL
Dim objCommand
Dim objRecordset
Dim v,i,t
v=SmartTags("InstV")
i=SmartTags("InstI")
t=SmartTags("time")
Set objConnection = CreateObject("ADODB.Connection")
objConnection.ConnectionString = "Provider=MSDASQL;DSN=voltage;UID=;PWD=;"
objConnection.Open
Set objCommand = CreateObject("ADODB.Command")
Set objRecordset = CreateObject("ADODB.Recordset")
objCommand.CommandType = 1 ' 1=adCmdText
Set objCommand.ActiveConnection = objConnection
objCommand.CommandText = "insert into Voltage (t,v) VALUES ("&t&","&v&")"
Set objRecordset = objCommand.Execute
objConnection.Close
Set objCommand = Nothing
Set objConnection = Nothing
Set objConnection = CreateObject("ADODB.Connection")
objConnection.ConnectionString = "Provider=MSDASQL;DSN=currnt;UID=;PWD=;"
objConnection.Open
Set objCommand = CreateObject("ADODB.Command")
Set objRecordset = CreateObject("ADODB.Recordset")
objCommand.CommandType = 1 ' 1=adCmdText
Set objCommand.ActiveConnection = objConnection
objCommand.CommandText = "insert into current (t,i) VALUES ("&t&","&i&")"
Set objRecordset = objCommand.Execute
objConnection.Close
Set objCommand = Nothing
Set objConnection = Nothing