Advertisement
worlok110

confronta database xojo

Jan 10th, 2014
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   Dim file1 As FolderItem
  2.   Dim file2 as folderitem
  3.   Dim db1 as new RealSQLDatabase
  4.   Dim db2 As New RealSQLDatabase
  5.   file1 = GetFolderItem( textfield1.text )
  6.   file2 = GetFolderItem( textfield2.text )
  7.  
  8.   If file1 <> Nil and file2 <> Nil Then
  9.    
  10.     db1.DatabaseFile = file1
  11.     db2.DatabaseFile = file2
  12.    
  13.     If db1.Connect and db2.Connect Then
  14.       Dim res1 as RecordSet
  15.       Dim res2 as RecordSet
  16.       res1 = db1.SQLSelect("SELECT * FROM sqlite_master WHERE type='table';")
  17.       res2 = db2.SQLSelect("SELECT * FROM sqlite_master WHERE type='table';")
  18.      
  19.       listbox1.deleteallrows
  20.      
  21.       Dim res3 as RecordSet
  22.       Dim res4 as RecordSet
  23.       Dim appoggio as String
  24.       dim appoggio2 as string
  25.       if res1 <> Nil and res2 <> nil then
  26.         While not res1.eof and not res2.eof
  27.           try
  28.             listbox1.addrow(res1.field("name").stringValue  , res2.field("name").stringvalue)
  29.            
  30.             listbox1.addRow("------------------" , "------------------")
  31.             appoggio =  res1.field("name").stringValue
  32.             appoggio2 =  res2.field("name").stringValue
  33.             res3 = db1.SQLSelect("PRAGMA table_info(" + appoggio+ ")")
  34.             res4 = db2.SQLSelect("PRAGMA table_info(" + appoggio2 + ")")
  35.             While not res3.eof and not res4.eof
  36.               appoggio = res3.field("name").stringValue + " (" +  res3.field("type").stringValue + ")"
  37.               appoggio2 =  res4.field("name").stringvalue + " (" +  res4.field("type").stringValue + ")"
  38.               listbox1.addrow(appoggio  , appoggio2)
  39.                res3.movenext
  40.               res4.movenext
  41.             wend
  42.            
  43.             listbox1.addRow("------------------" , "------------------")
  44.            
  45.             res1.movenext
  46.             res2.MoveNext
  47.           catch NilObjectException
  48.             Msgbox "Ci Sono dei valori nulli!"
  49.           end try
  50.         wend
  51.       else
  52.         MsgBox("Uno dei due risultati è vuoto!")
  53.       End if
  54.      
  55.       res1 = db1.SQLSelect("PRAGMA table_info(utente)")
  56.       res2 = db2.SQLSelect("SELECT * FROM sqlite_master WHERE type='table';")
  57.      
  58.       listbox1.deleteallrows
  59.      
  60.      
  61.       if res1 <> Nil and res2 <> nil then
  62.         While not res1.eof and not res2.eof
  63.           try
  64.             listbox1.addrow(res1.field("name").stringValue  , res2.field("name").stringvalue)
  65.            
  66.             res1.movenext
  67.             res2.MoveNext
  68.           catch NilObjectException
  69.             Msgbox "Ci Sono dei valori nulli!"
  70.           end try
  71.         wend
  72.       else
  73.         MsgBox("Uno dei due risultati è vuoto!")
  74.       End if
  75.      
  76.      
  77.     Else
  78.       MsgBox("Errore Database1: " + db1.ErrorMessage)
  79.       MsgBox("Errore Database2:" + db2.errormessage)
  80.     End If
  81.   End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement