vbscript Archestra SQL Select

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vbscript Archestra SQL Select相关的知识,希望对你有一定的参考价值。

dim msSqlConnection as System.Data.SqlClient.SqlConnection;
dim msSqlCommand as System.Data.SqlClient.SqlCommand;
dim msSqlDataAdapter as System.Data.SqlClient.SqlDataAdapter;
dim dataSet as System.Data.DataSet;

try

	' Define and open Connection
	msSqlConnection = new System.Data.SqlClient.SqlConnection(
		Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\\ArchestrA\\AuxConfig").GetValue("SQLConnection_HPA")
		);
	msSqlConnection.Open();

	' Setup Command
	msSqlCommand = new System.Data.SqlClient.SqlCommand("", msSqlConnection);
	msSqlCommand.CommandType = System.Data.CommandType.Text;
	msSqlCommand.CommandText = "SELECT tagname, SiloNum FROM HMI_SiloStatus WHERE SiloNum IN (207,215,227,231)";

	' Map in the Data Adapter
	msSqlDataAdapter = new System.Data.SqlClient.SqlDataAdapter(msSqlCommand);
	dataSet = new System.Data.DataSet();
	msSqlDataAdapter.Fill(dataSet);

  'Do something with the dataSet...

	' Commit and close the connection
	dataSet.Dispose();
catch
	' Something went wrong, rollback
	'LogError(System.String.Format("{0}: SQL Error {1}: {2}","Retrieve Brabender Data",error.GetType(),error.Message));
	'msSqlConnection.Close();
endtry;

' Perform Cleanup
if msSqlConnection <> NULL then msSqlConnection.Dispose(); endif;
if msSqlCommand <> NULL then msSqlCommand.Dispose(); endif;
msSqlDataAdapter = NULL; msSqlCommand = NULL; msSqlConnection = NULL;

以上是关于vbscript Archestra SQL Select的主要内容,如果未能解决你的问题,请参考以下文章

vbscript Archestra脚本标题

尝试使用 vbscript 显示 SQL 数据库中的数据

vbscript 获取SQL产品密钥。

vbscript 选择sql到DatagridView

vbscript 选择sql到DatagridView

vbscript SQL到Recordset