19-12-15, 02:18 AM
[quote pid='67652' dateline='1450343996']
الاخوة الاحباب نشكركم جميعا على المرور الى هذا اللحظة ما وجدت حل وبالنسبة الى الكود المستخدم كالتالي
[/quote]
الاخوة الاحباب نشكركم جميعا على المرور الى هذا اللحظة ما وجدت حل وبالنسبة الى الكود المستخدم كالتالي
كود :
Try
ListBox1.ClearSelected()
Catch ex As Exception
End Try
Dim Password As String
Sniper:
Try
Dim OpenFileDialog1 As New OpenFileDialog
Dim DataSet1 As New DataSet
If Password = "" Then
Dim myStream As Stream = Nothing
OpenFileDialog1.Filter = "Files (*.mdb;*.accdb;*.xls;*.xlsx)|*.mdb;*.accdb;*.xls;*.xlsx"
OpenFileDialog1.Title = "Select a Cursor File"
OpenFileDialog1.FilterIndex = 2
OpenFileDialog1.RestoreDirectory = True
If OpenFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
Try
myStream = OpenFileDialog1.OpenFile()
If (myStream IsNot Nothing) Then
DataBasePath = OpenFileDialog1.FileName.ToString
End If
Catch Ex As Exception
MessageBox.Show("Cannot read file from disk. Original error: " & Ex.Message)
Finally
If (myStream IsNot Nothing) Then
myStream.Close()
End If
End Try
End If
End If
Con55 = New OleDbConnection(GetProvider(DataBasePath, Password))
Con55.Open()
Dim schemaTable As DataTable = Con55.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, New Object() {Nothing, Nothing, Nothing, "TABLE"})
Dim Tables = (From Row As DataRow In schemaTable.Rows Where Row("TABLE_TYPE") = "TABLE" Select Row.Item("TABLE_NAME")).ToArray
ListBox1.Items.Clear()
ListBox1.Items.AddRange(Tables)
Con55.Close()
Catch ex As Exception
If Con55.State = ConnectionState.Open Then Con55.Close()
Password = InputBox("أدخل كلمة المرور لقاعدة البيانات", "كلمة المرور")
If Not String.IsNullOrEmpty(Password) Then
GoTo Sniper
End If
Finally
If Con55.State = ConnectionState.Open Then Con55.Close()
End Try[/quote]
الله المستعان
