Guest User

Untitled

a guest
Jul 20th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. using (SqlCeConnection conn = new SqlCeConnection(validateConnStr))
  2. {
  3. using (SqlCeCommand cmd = new SqlCeCommand(@"SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES", conn))
  4. {
  5. try
  6. {
  7. conn.Open();
  8. SqlCeDataReader rdr = cmd.ExecuteReader();
  9. string[] tableArr = { "FirstTable", "SecondTable" };
  10. int ta = 0;
  11. while (rdr.Read())
  12. {
  13. if (rdr.GetString(0) != tableArr[ta])
  14. {
  15. isValidDbFile = false;
  16. }
  17. else
  18. {
  19. isValidDbFile = true;
  20. }
  21. ta++;
  22. }
  23. }
  24. catch (Exception ex)
  25. {
  26. //MessageBox.Show(ex.ToString());
  27. }
  28. finally
  29. {
  30. conn.Close();
  31. }
  32. }
  33. }
Add Comment
Please, Sign In to add comment