mark jones

mark jones

  • NA
  • 31
  • 0

TABLE MAPPINGS EXCEPTION

Aug 23 2008 11:53 AM

Can someone please help me with the following I am getting a mappings exception as follows: 'Update unable to find TableMapping['MovTable1'] or DataTable 'MovTable1'.

This happens when I try to save the changes made when I have entered details onto a datagrid which is linked to a sql database..

the updated C# code I am now using is below....thanks for any help

 


//code when loading data grid//
private void button3_Click(object sender, System.EventArgs e)
  {   Form3 F3 = new Form3();
   SqlCommandBuilder cmdBuilder = new SqlCommandBuilder(MovAdapt);
   MovAdapt.TableMappings.Add("MovMapping", "MovTable1");
   Mcon.Open();
   Movcmd.CommandText = "SELECT * FROM MovTable1";
   MovAdapt.SelectCommand = Movcmd;
   MovAdapt.Fill(Movset1, "MovTable1");
            F3.dataGrid1.DataSource = Movset1;
   F3.Show();
  }

-----------------------------
//code behind the save button//

private void button1_Click(object sender, System.EventArgs e)
  {    
   F1.MovAdapt.Update(F1.Movset1, "MovTable1");       
   Form1.Mcon.Close();  
     
  }

 


  }