InsertOnSubmit 给出了这个错误。我该如何解决?
InsertOnSubmit gives this error. How do I fix this?
InsertOnSubmit 给出错误 "there is no argument given that corresponds to the required formal parameter 'entity' of table.InsertOnSubmit(chalet)"。我该如何解决这个问题?
这是我的代码。
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();
处给出了错误
像db.chalets.InsertOnSubmit(hetHuis);
一样传递db.chalets.InsertOnSubmit();
中的实体
InsertOnSubmit 给出错误 "there is no argument given that corresponds to the required formal parameter 'entity' of table.InsertOnSubmit(chalet)"。我该如何解决这个问题?
这是我的代码。
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();
处给出了错误像db.chalets.InsertOnSubmit(hetHuis);
db.chalets.InsertOnSubmit();
中的实体