تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[سؤال] vshost.exe has stopped working
#19
جرب وخبرني
كود :
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    Dim OpenFile As New OpenFileDialog With {
        .Filter = "Access (*.mdb;*.accdb)|*.mdb;*.accdb;|Excel (*.xls;*.xlsx)|*.xls;*.xlsx;",
        .Title = "Select a Cursor File"
       }

    If OpenFile.ShowDialog() = DialogResult.OK Then
        Con55.ConnectionString = GetProvider(OpenFile.FileName)

        Dim password As String = ""

        Try
            Con55.Open()
        Catch ex As Exception
            password = InputBox("قاعدة البيانات قد تتطلب كلمة مرور")
            Con55.ConnectionString = GetProvider(OpenFile.FileName, password)
        End Try

        ListBox1.Items.Clear()
        Try

            If Con55.State <> ConnectionState.Open Then Con55.Open()
            Dim schemaTable As DataTable = Con55.GetSchema("Tables", New String() {Nothing, Nothing, Nothing, "Table"})
            Con55.Close()
            Dim Tables = (From r In schemaTable Select r("TABLE_NAME")).ToArray
            ListBox1.Items.AddRange(Tables)

        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

    End If

End Sub

Public Function GetProvider(ByVal PathStr As String, Optional ByVal Password As String = "") As String
    Dim ProviderStr As String
    Select Case Path.GetExtension(PathStr)
        Case ".mdb"
            ProviderStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & PathStr & ";Jet OLEDB:Database Password=" & Password & ";"
        Case ".accdb"
            ProviderStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & PathStr & ";Persist Security Info=False;" & ";Jet OLEDB:Database Password=" & Password & ";"
        Case ".xls"
            ProviderStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source =" & PathStr & ";Extended Properties=Excel 8.0;"
        Case ".xlsx"
            ProviderStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & PathStr & ";Extended Properties=Excel 8.0;"
    End Select
    Return ProviderStr
End Function

سؤال هل انت واضع أداة OpenFileDialog1 من أدوات الفجوال؟
الرد }}}
تم الشكر بواسطة: البراء


الردود في هذا الموضوع
vshost.exe has stopped working - بواسطة البراء - 13-12-15, 01:58 AM
RE: vshost.exe has stopped working - بواسطة أبو عمر - 13-12-15, 07:56 AM
RE: vshost.exe has stopped working - بواسطة البراء - 13-12-15, 08:59 PM
RE: vshost.exe has stopped working - بواسطة hamada558 - 14-12-15, 01:58 AM
RE: vshost.exe has stopped working - بواسطة البراء - 14-12-15, 10:45 AM
RE: vshost.exe has stopped working - بواسطة HASAN6.0 - 14-12-15, 10:52 AM
RE: vshost.exe has stopped working - بواسطة البراء - 14-12-15, 12:37 PM
RE: vshost.exe has stopped working - بواسطة myalsailamy - 14-12-15, 01:28 PM
RE: vshost.exe has stopped working - بواسطة hamada558 - 14-12-15, 08:55 PM
RE: vshost.exe has stopped working - بواسطة البراء - 16-12-15, 10:29 AM
RE: vshost.exe has stopped working - بواسطة البراء - 17-12-15, 12:21 AM
RE: vshost.exe has stopped working - بواسطة البراء - 17-12-15, 01:19 PM
RE: vshost.exe has stopped working - بواسطة myalsailamy - 17-12-15, 01:33 PM
RE: vshost.exe has stopped working - بواسطة الاصيله - 18-12-15, 10:15 PM
RE: vshost.exe has stopped working - بواسطة البراء - 19-12-15, 02:18 AM
RE: vshost.exe has stopped working - بواسطة hamada558 - 19-12-15, 08:41 PM
RE: vshost.exe has stopped working - بواسطة البراء - 21-12-15, 12:16 PM
RE: vshost.exe has stopped working - بواسطة البراء - 22-12-15, 12:13 PM
RE: vshost.exe has stopped working - بواسطة hamada558 - 22-12-15, 02:12 PM
RE: vshost.exe has stopped working - بواسطة البراء - 23-12-15, 10:29 AM
RE: vshost.exe has stopped working - بواسطة zinom - 23-12-15, 11:33 AM

المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  [VB.NET] vshost32.exe has stopeed working اسامه الهرماوي 2 1,582 12-07-19, 04:12 AM
آخر رد: الكاتب
  microsoft visual studio 2017 has stopped working wisamdo 1 2,195 05-05-18, 10:50 PM
آخر رد: عبدالله الدوسري
  project has been stopped ddemed 0 1,701 13-06-17, 08:49 PM
آخر رد: ddemed

التنقل السريع :


يقوم بقرائة الموضوع: