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

Recommended Answers

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

Jump to Post

All 4 Replies

Hi Thanks For Youre Sharing asp.net code

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

no error but i wanna removed duplicate value

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.