سؤال في كود ضغط واصلاح قاعة بينات اكسس 2003 - ahmedbezia - 25-07-20
كود :
Public Sub CompactAccessDBT(ByVal connectionString As String, ByVal mdwfilename As String)
Try
Dim Engine = CreateObject("JRO.JetEngine")
Engine.CompactDatabase("provider=microsoft.ace.oledb.12.0;" & "Data Source=" & Application.StartupPath & "\AUTO.mdb;" & "Jet OLEDB:Database Password=AHMED1998;" & _
"Jet OLEDB:Engine Type=5;", _
"provider=microsoft.ace.oledb.12.0;" & _
"Jet OLEDB:Database Password=AHMED1998;" & _
"Data Source=" & Application.StartupPath & "\AUTO.mdb.tmp" & ";" & _
"Jet OLEDB:Engine Type=5;")
Dim FullPath As String = IO.Path.GetDirectoryName(Application.StartupPath & "\AUTO.mdb")
IO.File.Delete(Application.StartupPath & "\AUTO.mdb")
Dim filename As String = IO.Path.GetFileName(Application.StartupPath & "\AUTO.mdb.accdb" & ".tmp")
Dim GetFileNameWithoutExtension As String = IO.Path.GetFileNameWithoutExtension(Application.StartupPath & "\AUTO.mdb" & ".tmp")
FileSystem.Rename(Application.StartupPath & "\AUTO.mdb" & ".tmp", FullPath & "\" & GetFileNameWithoutExtension)
Catch ex As Exception
If InStr(ex.Message.ToUpper, "password".ToUpper) Or InStr(ex.Message.ToUpper, "password".ToUpper) Then
MsgBox("Password is invalid.", MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, "Password Database")
ElseIf My.Computer.FileSystem.FileExists(Application.StartupPath & "\AUTO.mdb") = False Then
MsgBox("Database Not found!", MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, "Erorr")
Else
MsgBox("Pressure operation failed!, Be sure not to open the database from another source.", MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, "Erorr")
End If
End Try
End Sub
السلام عليكم
اريد اين المشكل في هد الكود ضغط واصلاح قاعدة بينات اكسس 2003
RE: سؤال في كود ضغط واصلاح قاعة بينات اكسس 2003 - Jounior_P - 25-07-20
هل انت متأكد من هذا السطر ؟؟؟
Dim filename As String = IO.Path.GetFileName(Application.StartupPath & "\AUTO.mdb.accdb" & ".tmp")
RE: سؤال في كود ضغط واصلاح قاعة بينات اكسس 2003 - المهنا - 25-07-20
كود :
[size=small] Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click[/size]
[size=small] Try[/size]
[size=small] Application.DoEvents()[/size]
[size=small] 'اذا وجد نسخة بهذا الاسم يمسحها[/size]
[size=small] If IO.File.Exists(Application.StartupPath & "\Compact.mdb") Then[/size]
[size=small] IO.File.Delete(Application.StartupPath & "\Compact.mdb")[/size]
[size=small] End If[/size]
[size=small] ' كود ضغط واصلاح قاعدة البيانات[/size]
[size=small] Dim Engine[/size]
[size=small] Engine = CreateObject("JRO.JetEngine")[/size]
[size=small] Engine.CompactDatabase("provider=microsoft.jet.oledb.4.0;data source=" & Application.StartupPath & "\data11.mdb;user id=admin;jet oledb:database password=optimize",[/size]
[size=small] "provider=microsoft.jet.oledb.4.0;data source=" & Application.StartupPath & "\Compact.mdb;user id=admin;jet oledb:database password=optimize")[/size]
[size=small] 'كود حذف قاعدة البيانات القديمة[/size]
[size=small] Kill(Application.StartupPath & "\data11.mdb")[/size]
[size=small] 'كود اعادة تسمية قاعدة البيانات التي تم ضغطها واصلاحها[/size]
[size=small] My.Computer.FileSystem.RenameFile(Application.StartupPath & "\Compact.mdb", "data11.mdb")[/size]
[size=small] MsgBox("تمت عملية الضغط والإصلاح ")[/size]
[size=small] Catch ex As Exception[/size]
[size=small] MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)[/size]
[size=small] End Try[/size]
[size=small] End Sub[/size]
RE: سؤال في كود ضغط واصلاح قاعة بينات اكسس 2003 - ahmedbezia - 25-07-20
لم ينجح الامر اخي
RE: سؤال في كود ضغط واصلاح قاعة بينات اكسس 2003 - المهنا - 25-07-20
حمل ذا وعدل المعطيات ولا ارفق مثالك والشباب ماراح يقصرون
خبرتي قليلة
http://vb4arb.com/vb/attachment.php?aid=25299
RE: سؤال في كود ضغط واصلاح قاعة بينات اكسس 2003 - asemshahen5 - 26-07-20
|