Advertisement
Guest User

Untitled

a guest
May 19th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. namespace WET070073_I
  2. {
  3. public partial class User : Form
  4. {
  5.  
  6. //DataGridViewCheckBoxColumn checkboxcol = new DataGridViewCheckBoxColumn();
  7. private BindingSource bsource = new BindingSource();
  8. //private SqlDataAdapter dAdapter = new SqlDataAdapter();
  9. //String sql;
  10. //DataSet dset=null;
  11. //private SqlConnection connStr;
  12. //private DataGridView dgView = new DataGridView();
  13. //private DataTable table = new DataTable();
  14. //private SqlConnection connStr = new SqlConnection("Data Source=AUTUMN-PC\\SQLEXPRESS;Initial Catalog=RetailPOS;User Id=sa;Password=m1nwoo;");
  15.  
  16.  
  17.  
  18.  
  19.  
  20. public User()
  21. {
  22. InitializeComponent();
  23. }
  24.  
  25.  
  26.  
  27. private void User_Load(object sender, EventArgs e)
  28. {
  29. // TODO: This line of code loads data into the 'retailPOSDataSet1.USERPROFILE' table. You can move, or remove it, as needed.
  30. this.uSERPROFILETableAdapter.Fill(this.retailPOSDataSet1.USERPROFILE);
  31.  
  32.  
  33.  
  34. }
  35.  
  36.  
  37.  
  38. private void buttonMainMenu_Click(object sender, EventArgs e)
  39. {
  40. this.Close();
  41.  
  42. }
  43.  
  44. private void buttonUpdate_Click(object sender, EventArgs e)
  45. {
  46. SqlConnection conn = new SqlConnection("Data Source=AUTUMN-PC\\SQLEXPRESS;Initial Catalog=RetailPOS;User Id=sa;Password=m1nwoo;");
  47. string query = "select * from userprofile";
  48. SqlCommand cmd = new SqlCommand(query,conn);
  49. //Create a new data adapter based on the specified query.
  50.  
  51. SqlDataAdapter dAdapter = new SqlDataAdapter(cmd);
  52. //Create a command builder to generate SQL update, insert, and
  53. //delete commands based on selectCommand. These are used to
  54. DataSet dset = new DataSet();
  55. dset.Table[0] = dset;
  56. dAdapter.Fill(dset,"USERPROFILE");
  57.  
  58. dataGridView1.DataSource = bsource;
  59. dataGridView1.DataBindings = dset;
  60.  
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement