Click here to Skip to main content
11,922,026 members (37,868 online)
Rate this:
Please Sign up or sign in to vote.
See more: VB VB.NET
How repair mysql Table thourgh 10 using code
Posted 23-Feb-13 1:30am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

That's impossible to answer. Since we know nothing about how it's "damaged" how could we possibly tell you how it should be "fixed"?
AnnuBhai 15-Mar-13 7:38am
2: Dim sTableName() As String
3: Dim iTableRange As Integer
4: Dim iCount As Integer
5: Dim vTableRepair
6: Dim sTableRepair As String
7: Dim sfile As String
8: Dim BscFiles As New BasicFunction.Files
9: Dim mb As MySqlBackup
10: mb = New MySqlBackup(strc_Connstr_Mysql.SmartHawk)
11: sSQL = "Show tables"
12: ReDim sTableName(mb.DatabaseInfo.AllTableNames.Length)
13: Dim txttrm_createlog As TextStream
14: Dim fsoProcessLog As New FileSystemObject
Dim dtEnd As Date
81: Dim i As Integer

15: Array.Copy(mb.DatabaseInfo.AllTableNames, sTableName, mb.DatabaseInfo.AllTableNames.Length) 'copy array mb.DatabaseInfo.AllTableNames to sTableName

16: iCount = mb.DatabaseInfo.AllTableNames.Length
17: Dim LVItem As ListViewItem = New ListViewItem 'Creating object of the listview control

18: For iTableRange = 1 To mb.DatabaseInfo.AllTableNames.Length - 1 'loop for all tables of the database

19: prgBarGo.Value = prgBarGo.Value + Fix(100 / mb.DatabaseInfo.AllTableNames.Length)

20: LVItem = LvCheckNRpr.Items.Add("Checking Table " & sTableName(iTableRange).ToString) 'Adding new line in listview control

21: LvCheckNRpr.Refresh()

22: sSQL = "Check Table " & sTableName(iTableRange) & " medium"

23: sTableRepair = TableRepair(sSQL) 'firing query and returns result of that query

24: vTableRepair = Split(sTableRepair, ",") 'Spliting result of that query

25: If vTableRepair(2) <> "warning" Then

26: If Trim(vTableRepair(3)) = "Table is already up to date" Or Trim(vTableRepair(3)) = "OK" Then

27: LVItem.SubItems.Add("Table " & sTableName(iTableRange) & " Found Up To Date") 'Adding sub item in listview cntrol
28: LVItem.SubItems.Add("No Action Required") 'Adding sub item in listview cntrol
29: LVItem.SubItems.Add("Healthy") 'Adding sub item in listview cntrol

30: ElseIf vTableRepair(2) = "error" And vTableRepair(3) = "Corrupt" Then
31: LVItem.SubItems.Add(vTableRepair(3))

32: sfile = Application.StartupPath & "\" & Fix(Math.Round(1000) * 1000) & ".bat"

33: If BscFiles.mFileExist(sfile) = False Then
34: Create_Bat(sfile, sTableName(iTableRange)) 'Creating new batch file in applcation folder
35: Else
36: System.IO.File.Delete(sfile) 'If batch already in application folder then file will be delete and again create batch file in application folder
37: Create_Bat(sfile, sTableName(iTableRange)) 'Creating new batch file in applcation folder
38: End If

39: If BscFiles.mFileExist(sfile) = True Then
40: Shell(sfile) 'running created batch file
41: LVItem.SubItems.Add("Repair Required ") 'Adding sub item in listview cntrol
42: LVItem.SubItems.Add("Send For Repair") 'Adding sub item in listview cntrol

43: End If

44: sSQL = "Repair Table " & sTableName(iTableRange) & " use_frm"
45: g_FireSQL(sSQL) 'Firing query

46: sSQL = "Check Table " & sTableName(iTableRange) & " medium"

47: sTableRepair = TableRepair(sSQL) 'Again we have to check table repaired or not

48: vTableRepair = Split(sTableRepair, ",")

49: If Trim(vTableRepair(3)) = "Table is already up to date" Or Trim(vTableRepair(3)) = "OK" Then
50: LVItem.SubItems
AnnuBhai 15-Mar-13 7:38am
yes it is possible Dave Kreskowiak
AnnuBhai 15-Mar-13 7:41am
Here i have mysqlbacup dll using that dll i have all tables name
after that i created loop and for each tables if i got an error msg den i will create 1 batch file, in that batch file i wrote myisam check and recovery code and run that batch file and again check that table
Dave Kreskowiak 15-Mar-13 7:46am
I said your quesiton was impossible to answer because we didn't know anything about your database, which engine you were using, nor what you meant by "damaged".

I did NOT say repairing the database wasn't possible.

The quality of the answer you get is directly dictated by the quality of the question you ask, and you asked a poorly detaily question.
AnnuBhai 15-Mar-13 8:04am
k boss
AnnuBhai 15-Mar-13 7:47am
here some other work also doing like adding value in listview control and handling progress bar controls
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

what repair means ? clarify your needs..more briefly.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

first v have to check whether table is proper or not if proper den OK if not den have 2 repair it

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 493
1 Dave Kreskowiak 285
2 Sergey Alexandrovich Kryukov 243
3 Richard MacCutchan 155
4 ppolymorphe 135
0 OriginalGriff 7,231
1 KrunalRohit 4,530
2 Sergey Alexandrovich Kryukov 3,356
3 George Jonsson 2,865
4 Suvendu Shekhar Giri 2,216

Advertise | Privacy | Mobile
Web01 | 2.8.151120.1 | Last Updated 14 Mar 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100