01-05-17, 02:41 PM
اخي الفاضل يبدو ان المتغير connectionstring لايحمل اي قيمة في الدالة التالية :
PHP كود :
Public Sub btngittable(ComDataBase As ComboBox, listetable As DataGridView)
dt.Clear()
Dim ServerConnection As ServerConnection = Nothing
If ComDataBase.Text = Nothing Then
MessageBox.Show("yuo do not choose name ", " alert", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Exit Sub
End If
Dim objcn As New SqlConnection(connectionstring)
ServerConnection = New ServerConnection(objcn)
Dim server As New Server(ServerConnection)
Dim objTables As TableCollection = server.Databases(Databasename).Tables
If objTables.Count = 0 Then
MessageBox.Show(" there are tables in these database ", "alert", MessageBoxButtons.OK, MessageBoxIcon.Warning)
ComDataBase.Focus()
End If
cmd = New SqlCommand("select name as 'name_table' from dbo.sysobjects where xtype = 'u' order by name", objcn)
da = New SqlDataAdapter(cmd)
da.Fill(dt)
listetable.DataSource = dt
End Sub

