InsertOnSubmit gives error "there is no argument given that corresponds to the required formal parameter 'entity' of table.InsertOnSubmit(chalet)". How do I fix this?
This is my code.
public partial class MainWindow : Window
{
DataClasses1DataContext db = new DataClasses1DataContext();
public MainWindow()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
chalet hetHuis = new chalet();
hetHuis.Naamcode = naamcode.Text;
hetHuis.Persoonaantal = Convert.ToInt32(personenaantal.Text);
hetHuis.Klasse = Convert.ToString(klasse.SelectedItem);
db.chalets.InsertOnSubmit();
db.SubmitChanges();
}
}
it gives the error at db.chalets.InsertOnSubmit();
Pass the entity in
db.chalets.InsertOnSubmit();
likedb.chalets.InsertOnSubmit(hetHuis);