0
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();
}

Edited by deceptikon: Fixed code formatting

3
Contributors
4
Replies
20
Views
3 Years
Discussion Span
Last Post by rahul_22
0

Hello there sir, the number you are dialing is not in service anymore, please hold, someone will be there shortly. In the meanwhile please post the error you are getting with the error message.
Thanks

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.