Click here to Skip to main content
15,891,607 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using Data grid view control in window application.I am using data grid view to populate data from data base sql server 2005. when first time data is bind then correct data will show. Like....

SNo. Name Address DOB
1 santosh delhi 12 jan 1990
2 ashok mumbai 10 nov 1980

but when data is entered in various textbox and saved in data base, at the same time again data is populated then data grid view showing with previous data, and data is repeated. how can i remove repeated data from data grid view.


SNo. Name Address DOB
1 santosh delhi 12 jan 1990
2 ashok mumbai 10 nov 1980
1 santosh delhi 12 jan 1990
2 ashok mumbai 10 nov 1980
3 rajiv chennai 20 feb 1089


HOW CAN I REMOVE DUPLICATE RECORD IN DATA GRID VIEW ?
Posted
Updated 26-Jun-11 2:35am
v2

Try calling the Clear() property on the DataGridView before calling the grid view for second time.
 
Share this answer
 
v2
try this:

when you add new data successfully, try to call that method once again.
 
Share this answer
 
hi.please written in class:
{
public static int insert_man(string dore1)
{
if (Connection.Connect.State == ConnectionState.Open)
{
Connection.Connect.Close();
}
SqlCommand cmd = new SqlCommand("sp_insert_manegement", Connection.Connect);
cmd.Parameters.Add("@dore", SqlDbType.NVarChar).Value = dore1;

cmd.CommandType = CommandType.StoredProcedure;
Connection.Connect.Open();
int i = cmd.ExecuteNonQuery();
return i;
Connection.Connect.Close();
}
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900