in gridvew not display in duplicate values....
plz write the code
Gridvew not display in duplicate values
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Satyapriya NayakRank #47 · 31.5K reputationPosted Mar 10, 2013, 3:09 AM EDT
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
namespace Gridview
{
public partial class WebForm2 : System.Web.UI.Page
{
string connStr = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
SqlCommand com;
SqlDataAdapter sqlda;
DataSet ds;
string str;
protected void Page_Load(object sender, EventArgs e)
{
bindgrid();
}
private void bindgrid()
{
SqlConnection con = new SqlConnection(connStr);
con.Open();
str = "SELECT DISTINCT * FROM emp";
com = new SqlCommand(str, con);
sqlda = new SqlDataAdapter(com);
ds = new DataSet();
sqlda.Fill(ds, "emp");
GridView1.DataMember = "emp";
GridView1.DataSource = ds;
GridView1.DataBind();
con.Close();
}
}
}
Jignesh TrivediRank #16 · 50.3K reputationPosted Mar 10, 2013, 7:50 PM EDT
hi,
please refer below link, it might help you
http://www.aspdotnet-suresh.com/2012/02/remove-or-delete-duplicate-records-from.html
http://www.codeproject.com/Articles/36697/Eliminate-Duplicate-Values-from-the-Grid-View