0
테이블 보안 및 2 개의 필드 사용자 이름과 암호가 포함 된 데이터베이스가 있습니다. 삭제하려는 중복 데이터가 C#에서 중복됩니다 .net SQL 문은 무엇입니까? 중복 된 사용자 이름과 암호는 다른 파일에서 데이터베이스 파일을 업데이트하는 중에 발생합니다. 아니면 데이터베이스 기본 파일에 존재하지 않는 레코드 만 복사하는 방법. 나는 그것을 할 필요가 CSharp.net 여기에 내가 코드의 부분을 어디에 내가 데이터의 제거를하고 싶다. 이 MS-Access에서 중복 레코드를 제거해야합니다 같은 것을 실행중복 데이터를 삭제해야합니다 데이터베이스에서 MS 액세스의 프로그래밍 가능
private void ReadUFbtn_Click(object sender, EventArgs e)
{ //new data in desktop so it comes as Source so main becomes as backup
// backup is main so here is mail pis in opened
string targetPath = @"C:\Users\User\Desktop\Prashant\";
string constr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\\PIS.mdb;Jet OLEDB:Database Password=Prashant;";
Con = new OleDbConnection(@constr);
Con.Open();
Com = new OleDbCommand();
Com.Connection = Con;
try
{
if (!System.IO.Directory.Exists(targetPath))
{
DialogResult X = MessageBox.Show("The Direcory/5File Dose not exits", "PIS System");
}
else
{
//backup open
if (Con.State == ConnectionState.Closed)
Con.Open();
//target //main //backup //source from data //desktop
//backup // main data
string selQuery = "INSERT INTO Security SELECT DISTINCT * FROM [MS Access;DATABASE=c:\\Users\\User\\Desktop\\Prashant\\PIS.mdb;PWD=Prashant;].[Security]";
Com.CommandText = selQuery;
Com.CommandType = CommandType.Text;
Com.Connection = Con;
MessageBox.Show("File Updated");
Com.CommandText = "SELECT DISTINCT * FROM Security ";
int result = Com.ExecuteNonQuery();
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}