in gridvew not display in duplicate values....
plz write the code
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jignesh TrivediPosted Mar 10, 2013, 11:50 PM
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
Satyapriya NayakPosted Mar 10, 2013, 7:09 AM
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();
}
}
}