vbscript Archestra SQL存储过程

Posted

tags:

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

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("STP_RMS_RetrieveSiloList", msSqlConnection);
	msSqlCommand.CommandType = System.Data.CommandType.StoredProcedure;

	' Setup Parameters
	msSqlCommand.Parameters.Add("@V_QualityOverride", System.Data.SqlDbType.Bit).Value = b_QualityOverride;
	msSqlCommand.Parameters.Add("@V_IngrCode", System.Data.SqlDbType.NVarChar,50).Value = s_IngrCodeLink;
	msSqlCommand.Parameters.Add("@V_Line", System.Data.SqlDbType.Int).Value = line;

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

	' Populate the Silo List from the dataSet
	g_SiloChange.cb_SiloList.DisplayMember = "Display";
	g_SiloChange.cb_SiloList.ValueMember = "Tagname";
	g_SiloChange.cb_SiloList.DataSource = dataSet.Tables(0);

	' Push the Dataset into the app domain
	System.AppDomain.CurrentDomain.SetData("BatchingSiloList", dataSet);

	' Commit and close the connection
	dataSet.Dispose();
	msSqlDataAdapter.Dispose();
	msSqlCommand.Dispose();
	msSqlConnection.Close();

catch
	LogError(System.String.Format("{0}: SQL Error {1}: {2}","RetrieveSiloData", 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存储过程的主要内容,如果未能解决你的问题,请参考以下文章

vbscript Archestra脚本标题

VBScript - 在 SQL Server 中将 SHA1 存储为数字或二进制值

如何从SFTP服务器获取文本文件并在VBScript中本地存储

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

vbscript 获取SQL产品密钥。

vbscript 选择sql到DatagridView