6
Answers

remove redundant data from database.

Ask a question
Mittal Joshi

Mittal Joshi

14y
4.9k
1

I have some application no stored in database through search.if i again search any journal and if no is again match then it will no be store.........can anybody give me code for this.
i have tried this....
con =
new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|app_search.mdb;Persist Security Info=True");
con.Open();
cmd =
new OleDbCommand("select Application_no from Published_Application", con);

adp1 =
new OleDbDataAdapter(cmd);

adp1.Fill(ds2);
int s = ds2.Tables[0].Rows.Count ;
int t = 0;
dr3 = cmd.ExecuteReader(
CommandBehavior.Default);
while(dr3.Read())
{
if (t < s)
{
//string abc = dr1[0].ToString();
if (test_app1 != dr3[0].ToString())
{
while(t == s)
{
if (k.Trim().Contains(test_app))
{
//test_app = test_app.Replace(" ", "/");
string k1 = k.Trim();
cn =
new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|app_search.mdb;Persist Security Info=True");
int pNum = int.Parse(myFields.ExecuteThisJavascript("event.value=this.getPageLabel(" + p + ",true);"));
cn.Open();
query =
"insert into Published_Application (Application_no,country,date_app,date_pub,invention,classification,doc_no,priority_date,priority_country,filing_date,international_publication,patent_no,divisonal,Applicant_name,Applicant_Address,inventor_name,journal_no,page_no,j_year) values('" + test_app1 + "', '" + test1 + "','" + test2 + "','" + test3 + "','" + test4 + "' , '" + test5 + "','" + test6 + "','" + test7 + "', '" + test8 + "','" + test9 + "','" + test10 + "' ,'" + test11 + "','" + test12 + "', '" + test13 + "','" + test13_1 + "', '" + test14 + "','" + journal + "','" + p1 + "','" + journal2 + "')";
cmd =
new OleDbCommand(query, cn);
cmd.ExecuteNonQuery();
cn.Close();
}

}
t = t + 1;
}
//t = t + 1;


}


}

 

Answers (6)