string s = "select * from StudentDetails";
SqlDataAdapter da = new SqlDataAdapter(s, con);
DataSet ds = new DataSet();
DataRow therow;
try
{
con.Open();
da.Fill(ds, "StudentDetails");
TextBox1.Text = ""
string s = "select * from StudentDetails";
SqlDataAdapter da = new SqlDataAdapter(s, con);
DataSet ds = new DataSet();
DataRow therow;
try
{
con.Open();
da.Fill(ds, "StudentDetails");
TextBox1.Text = "";
con.Close();
int i = ds.Tables["StudentDetails"].Rows.Count;
for (int j = 0; j < i; j++)
{
therow = ds.Tables["StudentDetails"].Rows[j];
TextBox1.Text += therow["ContactEmail"].ToString() + ",";
TextBox1.Text += therow["FatherEmail1"].ToString() + ",";
TextBox1.Text += therow["FatherEmail2"].ToString() + ",";
TextBox1.Text += therow["MotherEmail1"].ToString() + ",";
TextBox1.Text += therow["MotherEmail2"].ToString() + ",";
}
TextBox1.Text = TextBox1.Text.TrimEnd(',');
}
catch (SqlException ex)
{
con.Close();
}
con.Close();
int i = ds.Tables["StudentDetails"].Rows.Count;
for (int j = 0; j < i; j++)
{
therow = ds.Tables["StudentDetails"].Rows[j];
TextBox1.Text += therow["ContactEmail"].ToString() + ",";
TextBox1.Text += therow["FatherEmail1"].ToString() + ",";
TextBox1.Text += therow["FatherEmail2"].ToString() + ",";
TextBox1.Text += therow["MotherEmail1"].ToString() + ",";
TextBox1.Text += therow["MotherEmail2"].ToString() + ",";
}
TextBox1.Text = TextBox1.Text.TrimEnd(',');
}
catch (SqlException ex)
{
con.Close();
}
rahulsingh725 0 Newbie Poster
rahulsingh725 0 Newbie Poster
peghooks 0 Newbie Poster
Michael27 29 Newbie Poster
rahulsingh725 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.