<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As
System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(_Class))
Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand
Me.SqlInsertCommand1 = New System.Data.SqlClient.SqlCommand
Me.SqlUpdateCommand1 = New System.Data.SqlClient.SqlCommand
Me.SqlDeleteCommand1 = New System.Data.SqlClient.SqlCommand
Me.SqlDataAdapter1 = New System.Data.SqlClient.SqlDataAdapter
Me.SqlConnection1 = New System.Data.SqlClient.SqlConnection
.....
.....
Me.SqlInsertCommand1.CommandText = resources.GetString("SqlInsertCommand1.CommandText")
Me.SqlInsertCommand1.Connection = Me.SqlConnection1
Me.SqlInsertCommand1.Parameters.AddRange(New System.Data.SqlClient.SqlParameter() {New System.Data.SqlClient.SqlParameter("@MAIN_FACILITY_USED", System.Data.SqlDbType.NVarChar, 0, "MAIN FACILITY USED")
如何使用以下行我无法访问有关sqlinsert命令的参数集合,但我可以通过以下代码访问sqlinsertcommand及其命令文本:
Dim flags As BindingFlags = BindingFlags.NonPublic Or BindingFlags.Instance Or BindingFlags.NonPublic
For Each info As FieldInfo In AssemblyInstance.GetType().GetFields(flags)
If info.FieldType.FullName = "System.Data.SqlClient.SqlCommand" Then
cmd = CType(info.GetValue(AssemblyInstance), SqlCommand)
End If
Next
如何通过fieldinfo或&gt; NET Reflection中的其他相关类来访问该sqlparameter集合? 看起来很粗鲁,但任何帮助甚至建议对我来说意义重大。
答案 0 :(得分:0)
所以“cmd”是“System.Data.SqlClient.SqlCommand”的实例? - 是的,它应该。 然后它有一个属性“参数”,它保存你的参数。