在本机读写accese数据库发生并发冲突,第二个this.oleDbDataAdapter1.Update(。。)时发生;
private void getstandardall()
{
DataTable tempDataTable1 = this.bzjzhbDataTable.Copy();
DataView viewalltemp1 = new DataView(tempDataTable1);
OleDbConnection myConnectionbzjzhb = new OleDbConnection(oleDbConnection1.ConnectionString);
myConnectionbzjzhb.Open();
OleDbCommand myCommandbzjzhb = new OleDbCommand( "DELETE * FROM Standardzhb ", myConnectionbzjzhb);
myCommandbzjzhb.ExecuteNonQuery();
myConnectionbzjzhb.Close();
GoldPrinter.ExcelAccess excel = new GoldPrinter.ExcelAccess();
string path = @ "d:\exb\bzjzhb ";
string result,getbzjggxj,getbzjjs,getbzjclassfy,getbzjparameter,getbzjnb,getbzjnbjj,getbzjPara;
int findi=1,finefh;
try
{
string[] dirs = Directory.GetFiles(@ "d:\exb\bzjzhb ");
foreach (string dir in dirs)
{
getbzjnb=dir.Substring(dir.IndexOf( " ")+1).Substring(0,dir.Substring(dir.IndexOf( " ")+1).IndexOf( "部 "));//dir.IndexOf( "部 " )
excel.Open(dir);
while(findi <500)
{
getbzjggxj=excel.GetCellText(findi, "D " );
getbzjjs=excel.GetCellText(findi, "G " );
if(getbzjggxj.IndexOf( "; ")> 0 || getbzjggxj.IndexOf( "; ")> 0)
{
finefh=getbzjggxj.IndexOf( "; ");
getbzjclassfy=getbzjggxj.Substring(0,finefh);
getbzjparameter=getbzjggxj.Substring(finefh+1,getbzjggxj.Length-finefh-1);
getbzjnbjj=getbzjnb+ "= "+getbzjjs;
getbzjPara=DeelNumberString(getbzjclassfy);
DataRow newRow = tempDataTable1.NewRow();
newRow[2] = getbzjclassfy;
newRow[3] = getbzjggxj;
newRow[4] = getbzjnb;
newRow[5] = getbzjnbjj;
newRow[8]=getbzjPara;
newRow[9] = getbzjparameter;
newRow[0] = Convert.ToInt16(getbzjjs);
tempDataTable1.Rows.Add(newRow);
}
&