Imports System.IO Imports System.Data Imports System.Data.SqlTypes Imports System.Data.SqlClient Public Class frmSysadminTableSelector Inherits System.Windows.Forms.Form #Region " Vom Windows Form Designer generierter Code " Public Sub New() MyBase.New() ' Dieser Aufruf ist für den Windows Form-Designer erforderlich. InitializeComponent() ' Initialisierungen nach dem Aufruf InitializeComponent() hinzufügen End Sub ' Die Form überschreibt den Löschvorgang der Basisklasse, um Komponenten zu bereinigen. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub ' Für Windows Form-Designer erforderlich Private components As System.ComponentModel.IContainer 'HINWEIS: Die folgende Prozedur ist für den Windows Form-Designer erforderlich 'Sie kann mit dem Windows Form-Designer modifiziert werden. 'Verwenden Sie nicht den Code-Editor zur Bearbeitung. Friend WithEvents SqlDataAdapter1 As System.Data.SqlClient.SqlDataAdapter Friend WithEvents SqlSelectCommand1 As System.Data.SqlClient.SqlCommand Friend WithEvents SqlInsertCommand1 As System.Data.SqlClient.SqlCommand Friend WithEvents SqlConnection1 As System.Data.SqlClient.SqlConnection Friend WithEvents DataSet1 As System.Data.DataSet Friend WithEvents ListBox1 As System.Windows.Forms.ListBox Private Sub InitializeComponent() Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmSysadminTableSelector)) Me.SqlDataAdapter1 = New System.Data.SqlClient.SqlDataAdapter Me.SqlInsertCommand1 = New System.Data.SqlClient.SqlCommand Me.SqlConnection1 = New System.Data.SqlClient.SqlConnection Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand Me.DataSet1 = New System.Data.DataSet Me.ListBox1 = New System.Windows.Forms.ListBox CType(Me.DataSet1, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'SqlDataAdapter1 ' Me.SqlDataAdapter1.InsertCommand = Me.SqlInsertCommand1 Me.SqlDataAdapter1.SelectCommand = Me.SqlSelectCommand1 Me.SqlDataAdapter1.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "sysobjects", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("name", "name"), New System.Data.Common.DataColumnMapping("id", "id"), New System.Data.Common.DataColumnMapping("xtype", "xtype"), New System.Data.Common.DataColumnMapping("uid", "uid"), New System.Data.Common.DataColumnMapping("info", "info"), New System.Data.Common.DataColumnMapping("status", "status"), New System.Data.Common.DataColumnMapping("base_schema_ver", "base_schema_ver"), New System.Data.Common.DataColumnMapping("replinfo", "replinfo"), New System.Data.Common.DataColumnMapping("parent_obj", "parent_obj"), New System.Data.Common.DataColumnMapping("crdate", "crdate"), New System.Data.Common.DataColumnMapping("ftcatid", "ftcatid"), New System.Data.Common.DataColumnMapping("schema_ver", "schema_ver"), New System.Data.Common.DataColumnMapping("stats_schema_ver", "stats_schema_ver"), New System.Data.Common.DataColumnMapping("type", "type"), New System.Data.Common.DataColumnMapping("userstat", "userstat"), New System.Data.Common.DataColumnMapping("sysstat", "sysstat"), New System.Data.Common.DataColumnMapping("indexdel", "indexdel"), New System.Data.Common.DataColumnMapping("refdate", "refdate"), New System.Data.Common.DataColumnMapping("version", "version"), New System.Data.Common.DataColumnMapping("deltrig", "deltrig"), New System.Data.Common.DataColumnMapping("instrig", "instrig"), New System.Data.Common.DataColumnMapping("updtrig", "updtrig"), New System.Data.Common.DataColumnMapping("seltrig", "seltrig"), New System.Data.Common.DataColumnMapping("category", "category"), New System.Data.Common.DataColumnMapping("cache", "cache")})}) ' 'SqlInsertCommand1 ' Me.SqlInsertCommand1.CommandText = "[pv_sysobjects_insert]" Me.SqlInsertCommand1.CommandType = System.Data.CommandType.StoredProcedure Me.SqlInsertCommand1.Connection = Me.SqlConnection1 Me.SqlInsertCommand1.Parameters.AddRange(New System.Data.SqlClient.SqlParameter() {New System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, False, CType(0, Byte), CType(0, Byte), "", System.Data.DataRowVersion.Current, Nothing), New System.Data.SqlClient.SqlParameter("@name", System.Data.SqlDbType.NVarChar, 128, "name"), New System.Data.SqlClient.SqlParameter("@id", System.Data.SqlDbType.Int, 4, "id"), New System.Data.SqlClient.SqlParameter("@xtype", System.Data.SqlDbType.VarChar, 2, "xtype"), New System.Data.SqlClient.SqlParameter("@uid", System.Data.SqlDbType.Int, 2, "uid"), New System.Data.SqlClient.SqlParameter("@info", System.Data.SqlDbType.Int, 2, "info"), New System.Data.SqlClient.SqlParameter("@status", System.Data.SqlDbType.Int, 4, "status"), New System.Data.SqlClient.SqlParameter("@base_schema_ver", System.Data.SqlDbType.Int, 4, "base_schema_ver"), New System.Data.SqlClient.SqlParameter("@replinfo", System.Data.SqlDbType.Int, 4, "replinfo"), New System.Data.SqlClient.SqlParameter("@parent_obj", System.Data.SqlDbType.Int, 4, "parent_obj"), New System.Data.SqlClient.SqlParameter("@crdate", System.Data.SqlDbType.DateTime, 8, "crdate"), New System.Data.SqlClient.SqlParameter("@ftcatid", System.Data.SqlDbType.Int, 2, "ftcatid")}) ' 'SqlConnection1 ' Me.SqlConnection1.ConnectionString = "data source=shu;initial catalog=edoka;persist security info=False;user id=sa;work" & _ "station id=SHU;packet size=4096" Me.SqlConnection1.FireInfoMessageEventOnUserErrors = False ' 'SqlSelectCommand1 ' Me.SqlSelectCommand1.CommandText = "[pv_sysobjects_select]" Me.SqlSelectCommand1.CommandType = System.Data.CommandType.StoredProcedure Me.SqlSelectCommand1.Connection = Me.SqlConnection1 Me.SqlSelectCommand1.Parameters.AddRange(New System.Data.SqlClient.SqlParameter() {New System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, False, CType(0, Byte), CType(0, Byte), "", System.Data.DataRowVersion.Current, Nothing)}) ' 'DataSet1 ' Me.DataSet1.DataSetName = "NewDataSet" Me.DataSet1.Locale = New System.Globalization.CultureInfo("de-CH") ' 'ListBox1 ' Me.ListBox1.Location = New System.Drawing.Point(8, 16) Me.ListBox1.Name = "ListBox1" Me.ListBox1.Size = New System.Drawing.Size(240, 316) Me.ListBox1.TabIndex = 0 ' 'frmSysadminTableSelector ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(256, 349) Me.Controls.Add(Me.ListBox1) Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) Me.Name = "frmSysadminTableSelector" Me.Text = "Tabelle auswählen" CType(Me.DataSet1, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) End Sub #End Region Private Sub frmSysadminTableSelector_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim ds As New DataSet Dim connection As New SqlConnection() Dim da As New SqlDataAdapter("", connection) Dim sqlcmd As New SqlCommand sqlcmd.CommandText = "dbo.sp_sysobjects_select" sqlcmd.CommandType = CommandType.StoredProcedure sqlcmd.Connection = connection Try connection.ConnectionString = My.Settings.ConnectionString connection.Open() da.SelectCommand = sqlcmd da.Fill(ds, "Datatable1") Catch ex As Exception Finally connection.Close() da.Dispose() sqlcmd.Dispose() End Try Dim i As Integer For i = 0 To ds.Tables(0).Rows.Count - 1 Me.ListBox1.Items.Add(ds.Tables(0).Rows(i)(0)) Next Me.SqlConnection1.Close() End Sub Private Sub listbox1_dblclick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.DoubleClick Close() End Sub Public Function get_tablename() As String get_tablename = "" Me.ShowDialog() Return Me.ListBox1.SelectedItem End Function End Class