Guest User

Untitled

a guest
Jan 17th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. //Header file
  2. using System.Data;
  3. using System.Data.SqlClient;
  4. using System.Configuration;
  5.  
  6.  
  7.  
  8. public Form3()
  9. {
  10. InitializeComponent();
  11.  
  12. //string cs = Properties.Settings.TestDatabaseConnectionString;
  13. var connectionString = ConfigurationManager.ConnectionStrings["TestDatabaseConnectionString"].ConnectionString;
  14.  
  15. using (SqlConnection con = new SqlConnection())
  16. {
  17. con.ConnectionString = connectionString;
  18.  
  19. SqlCommand cmd = new SqlCommand();
  20. cmd.CommandType = CommandType.StoredProcedure;
  21. cmd.CommandText = "ReportStudentDetails";
  22. cmd.Connection = con;
  23.  
  24. con.Open();
  25. SqlDataAdapter sda = new SqlDataAdapter(cmd);
  26. DataSet ds = new DataSet();
  27. sda.Fill(ds);
  28.  
  29. gridControl1.DataSource = ds;
  30. gridControl1.DataBind(); // showing error
  31. con.Close();
  32.  
  33. }
  34.  
  35. }
Add Comment
Please, Sign In to add comment