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();
中给出错误答案 0 :(得分:0)
将实体传递到db.chalets.InsertOnSubmit();
,如db.chalets.InsertOnSubmit(hetHuis);