Dim connect As String = "Provider=Microsoft.Jet.OLEDB.4.0 ;Jet OLEDBatabase Password='123321';Data Source=" & Application.StartupPath & "\dbkarneh.mdb"
Using conn As New OleDbConnection(connect)
Using cmd As New OleDbCommand()
cmd.Connection = conn
cmd.CommandText = "SELECT * INTO [MS Access;Database Password='123321';Data Source=" & Application.StartupPath & "\dbkarneh1.mdb].[student] FROM [student]"
conn.Open()
cmd.ExecuteNonQuery()
End Using
End Using
MsgBox("تم التسويه بنجاح", MsgBoxStyle.Information + MsgBoxStyle.MsgBoxRight, " ")
Public Shared Sub TransportTable(ByVal sourceDbPath As String, ByVal targetDbPath As String, ByVal lstTables As List(Of String)) Dim constr As String = ((Convert.ToString("Provider=Microsoft.JET.OLEDB.4.0;data source=") & targetDbPath) + ";Persist Security Info=False;") Dim conn = New OleDbConnection(constr) Dim yescommander = New OleDbCommand() conn.Open() lstTables.ForEach(Sub(tableName As [String]) yescommander.CommandType = CommandType.Text yescommander.Connection = conn yescommander.CommandText = (Convert.ToString("SELECT f.* INTO " + tableName + " FROM " + tableName + " AS f IN '") & sourceDbPath) + "';" Dim result As Integer = yescommander.ExecuteNonQuery()
24-02-16, 03:41 PM (آخر تعديل لهذه المشاركة : 24-02-16, 03:47 PM {2} بواسطة atefkhalf2004.)
معلهش يا استاذ
انا غعلا معرفتش
وحاولت التنسيق والتعديل لكن لم انج
برجاء تعديل الكود حسب القواعد والمسميات الواردة في مثالي
Dim constr As String = ((Convert.ToString("Provider=Microsoft.JET.OLEDB.4.0;data source=") & Application.StartupPath & "\dbkarneh.mdb") + ";Persist Security Info=False;")
Dim conn = New OleDbConnection(constr)
Dim yescommander = New OleDbCommand()
conn.Open()
dbkarneh.ForEach(Sub(tableName As [String])
yescommander.CommandType = CommandType.Text
yescommander.Connection = conn
yescommander.CommandText = (Convert.ToString("SELECT f.* INTO " & student & " FROM " + student + " AS f IN '") & Application.StartupPath) + "';"
Dim result As Integer = yescommander.ExecuteNonQuery()