我的代码:
OleDbConnection thisConnection=new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\wwwroot\new\news.mdb");
thisConnection.Open();
OleDbDataAdapter thisAdapter = new OleDbDataAdapter("SELECT CustomerID,CompanyName FROM Customers",thisConnection);
OleDbCommandBuilder thisBuilder = new OleDbCommandBuilder(thisAdapter);

DataSet ds= new DataSet();
thisAdapter.Fill(ds,"Customers"); Label1.Text=ds.Tables["Customers"].Rows.Count.ToString();
DataColumn[] keys= new DataColumn[1];
keys[0]=ds.Tables["Customers"].Columns["CustomerID"];
ds.Tables["Customers"].PrimaryKey=keys;
DataRow FindRow =ds.Tables["Customers"].Rows.Find("id号码99");
if(FindRow!=null)
{

FindRow.Delete();
thisAdapter.Update(ds,"Customers");
thisAdapter.Fill(ds,"Customers");
}
Label2.Text=ds.Tables["Customers"].Rows.Count.ToString();
thisConnection.Close();
Access数据库
抛出异常:System.InvalidOperationException: 对于不返回任何键列信息的 SelectCommand 不支持 DeleteCommand 的动态 SQL 生成.
主键设置了的.对数据库的添加、修改都没问题.就只删除会抛出异常........