InsertOnSubmit 给出错误“没有给出与 table.InsertOnSubmit(chalet) 所需的形式参数'entity'相对应的参数”。我该如何解决?
这是我的代码。
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();
}
}
它在 db.chalets.InsertOnSubmit() 处给出错误;