I want to bind complete DataTable
data to RichTextBox
, but i am getting only one cell by using this code below. How can i get the first row data to RichTextBox
?
SqlConnection con = new SqlConnection(@"data source=CENSYS01\SQLEXPRESS; Initial Catalog=myTest; Integrated Security=True");
SqlCommand cmd = new SqlCommand("select * from student", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
richTextBox1.DataBindings.Add("Text", dt, "Sno" );