菜鸟散分,顺便请教一个问题(windows窗体) 导入数据库中1.txt对应表A2.txt对应表Bselect id from A where id not in (select id from B) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 上面的是一种方法,还可以不通过数据库:1.先把2。txt中的内容读到一个ArrayList对象中;2.然后一行一行读取1。txt文件,读一行判断一下,在ArrayList对象中存不存在该字符串,如果不存在,就写入3。txt读取文件的代码:string FILE_NAME="路径+1.txt";if(!File.Exists(FILE_NAME)){ MessageBox("该文件不存在"); return;}StreamReader sr=new StreamReader(FILE_NAME,Encoding.Default);while(sr.Peek()>-1){ string strRead=sr.ReadLine();} Edison621(柏拉图的永恒)的方法可以 private ArrayList GetResult(){ ArrayList result = new ArrayList(); ArrayList txt1 = new ArrayList(); ArrayList txt2 = new ArrayList(); StreamReader file1 = new StreamReader("1.txt"); StreamReader file2 = new StreamReader("2.txt"); string file1String = null; file1String = file1.ReadLine(); while(file1String != null){ txt1.Add(file1String); file1String = file1.ReadLine(); } file1.Close(); string file2String = null; file2String = file2.ReadLine(); while(file2String != null){ txt2.Add(file2String); file2String = file2.ReadLine(); } file2.Close(); foreach(string temp1 in txt1){ bool isHas = false; foreach(string temp2 in txt2){ if(temp1 == temp2){ isHas = true; break; } } if(isHas == true){ continue; }else{ result.Add(temp1); } } return result; } 将2读如一个数组中,然后将一一行一行的读,in 2则COntinue,OtherWise insert.. c# listview添加合计行 加载有窗体的dll后,退出报错 100分求助:如何让方框随着鼠标Click而移动啊? vs2005 无法调试(断点设置正确) 如何实现使用应用程序post数据打开浏览器网页 25次回复中23次up的问题,太难?太简单? 怎样在dreamweaver中使用treeview控件,急用!!!如能解决马上给分! 中、英文字符串混合处理的问题? 求助~!!!!!!!!!!急 在后台运行而一般用户感觉不到的程序 用什么控件显示大量图片 .net 访问oracle乱码问题
1.先把2。txt中的内容读到一个ArrayList对象中;
2.然后一行一行读取1。txt文件,读一行判断一下,在ArrayList对象中存不存在该字符串,如果不存在,就写入3。txt读取文件的代码:
string FILE_NAME="路径+1.txt";
if(!File.Exists(FILE_NAME))
{
MessageBox("该文件不存在");
return;
}
StreamReader sr=new StreamReader(FILE_NAME,Encoding.Default);
while(sr.Peek()>-1)
{
string strRead=sr.ReadLine();
}
ArrayList result = new ArrayList();
ArrayList txt1 = new ArrayList();
ArrayList txt2 = new ArrayList(); StreamReader file1 = new StreamReader("1.txt");
StreamReader file2 = new StreamReader("2.txt"); string file1String = null;
file1String = file1.ReadLine();
while(file1String != null){
txt1.Add(file1String);
file1String = file1.ReadLine();
}
file1.Close(); string file2String = null;
file2String = file2.ReadLine();
while(file2String != null){
txt2.Add(file2String);
file2String = file2.ReadLine();
}
file2.Close(); foreach(string temp1 in txt1){
bool isHas = false;
foreach(string temp2 in txt2){
if(temp1 == temp2){
isHas = true;
break;
}
} if(isHas == true){
continue;
}else{
result.Add(temp1);
}
} return result;
}
然后将一一行一行的读,in 2
则COntinue,OtherWise insert..