I'm trying to delete several rows from tblOrderAA and one row from tblProInfo :(look at the picture)
Here is the code. The error I get is:
"the record has been deleted"
private void DeleteFromDataBase()
{
string connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Projects_2012\\Project_Noam\\Access\\myProject.accdb";
OleDbConnection myConnection = new OleDbConnection(connectionString);
string myDeleteQuery ="DELETE tblOrderAA.*, tblProInfo.*"+
" FROM tblProInfo INNER JOIN tblOrderAA ON tblProInfo.proInfoSerialNum = tblOrderAA.orderAASerialPro" +
" WHERE (((tblProInfo.proInfoScienceName)='"+comboBox1.SelectedItem.ToString()+"'))";
OleDbCommand myCommand = new OleDbCommand(myDeleteQuery);
myCommand.Connection = myConnection;
try
{
myConnection.Open();
myCommand.ExecuteNonQuery();
myCommand.Connection.Close();
MessageBox.Show("success");
}
catch (Exception e)
{
MessageBox.Show("error in : \n" + e.ToString());
}
**NOTE:**When I use this code with SELECT instead DELETE it works.
Database Diagramunder your database. The relationships are the connecting lines/arrows. Right-click properties on those.