Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. private void connect()
  2. {
  3. try
  4. {
  5. if (checkbox1.Checked == false)
  6. {
  7. FilePath = @"C:FILE";
  8. }
  9. else
  10. {
  11. FilePath = @"\192.168.0.2file"; //
  12. }
  13. strConn = @"Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" + FilePath + @";Extensions=csv,txt";
  14. Connect = new OdbcConnection(strConn);
  15. Connect.Open();
  16. }
  17. catch (Exception Ex)
  18. {
  19. MessageBox.Show(Ex.Message);
  20. }
  21.  
  22.  
  23. DataGrid1.SelectAll();
  24. DataGrid1.ClearSelection();
  25.  
  26.  
  27. FileName = ".csv";
  28. CSVDataSource = FilePath + FileName;
  29. ReadData(FileName);
  30. DataGrid1.Update();
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement