27-07-15, 04:01 AM
هذا الكود هو لدالة للتحقق من قاعدة بيانات نوع acces وانا أريد تحويل الكود ليعمل معي على ال SQLite
Public Function TableExists() As Boolean
Try
conp = New SQLiteConnection("Data Source='" & ofd.FileName & "'")
Dim t(5) As String
t(0) = "classe"
t(1) = "eleves"
t(2) = "istiara"
t(3) = "livre"
t(4) = "section_livre"
For a As Integer = 0 To 4
If conp.State = ConnectionState.Open Then conn.Close()
conp.Open()
Dim dbSchema As DataTable = conp.GetOleDbSchemaTable(OleDb.OleDbSchemaGuid.Tables, New Object() {Nothing, Nothing, t(a), "TABLE"})
If dbSchema.Rows.Count > 0 Then
TableExists = True
Else
TableExists = False
Exit Function
End If
Next
Return TableExists
Catch ex As Exception
If conn.State = ConnectionState.Open Then conn.Close()
MsgBox(ex.Message)
End Try
End Function
Public Function TableExists() As Boolean
Try
conp = New SQLiteConnection("Data Source='" & ofd.FileName & "'")
Dim t(5) As String
t(0) = "classe"
t(1) = "eleves"
t(2) = "istiara"
t(3) = "livre"
t(4) = "section_livre"
For a As Integer = 0 To 4
If conp.State = ConnectionState.Open Then conn.Close()
conp.Open()
Dim dbSchema As DataTable = conp.GetOleDbSchemaTable(OleDb.OleDbSchemaGuid.Tables, New Object() {Nothing, Nothing, t(a), "TABLE"})
If dbSchema.Rows.Count > 0 Then
TableExists = True
Else
TableExists = False
Exit Function
End If
Next
Return TableExists
Catch ex As Exception
If conn.State = ConnectionState.Open Then conn.Close()
MsgBox(ex.Message)
End Try
End Function