我正在我的命令中加入表格。我想删除当前行。
以下是我的命令和我通常做的事情。
但今天我有错误:
多表删除行
不支持生成的sql
这是什么意思?
OleDbCommand mycmdL = new OleDbCommand("SELECT DISTINCT AreaSize.*, Bathrooms.*, Cities.*, Prices.*, Properties.*, Rooms.*, Types.*, Users.* FROM Users INNER JOIN (Types INNER JOIN (Rooms INNER JOIN (Prices INNER JOIN (Cities INNER JOIN (Bathrooms INNER JOIN (AreaSize INNER JOIN Properties ON AreaSize.AreaSizeID = Properties.AreaSize) ON Bathrooms.BathroomID = Properties.Bathrooms) ON Cities.CityID = Properties.City) ON Prices.PriceID = Properties.Price) ON Rooms.RoomID = Properties.Rooms) ON Types.TypeID = Properties.PropertyType) ON Users.UserID = Properties.AgentID WHERE Users.UserID =@userID", clsDataSource.mycon);
myadaptL = new OleDbDataAdapter(mycmdL);
myadaptL.Fill(clsDataSource.myset, "Properties");
tbListing = clsDataSource.myset.Tables["Properties"];
删除当前行的代码:
try
{
if (MessageBox.Show("Are you sure?", "??", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
DataRow myrow = tbListing.Rows[current];
myrow.Delete();
OleDbCommandBuilder mybuild = new OleDbCommandBuilder(myadaptL);
myadaptL.Update(tbListing);
}
}
catch (Exception)
{
throw;
}
}