テーブルの 1 つに行を挿入しようとしているので、Web を調べて DATACONTEXT を使用する例を見つけたところ、次のものが見つかりました。
protected void buttonSave_Click(object sender, EventArgs e)
{
using (NorthwindDataContext context = new NorthwindDataContext())
{
Customer customer = new Customer
{
CustomerID = textBoxCustomerID.Text,
CompanyName = textBoxCompanyName.Text,
ContactName = textBoxCustomerName.Text,
ContactTitle = textBoxTitle.Text,
Address = textBoxAddress.Text,
City = textBoxCity.Text,
Region = textBoxRegion.Text,
PostalCode = textBoxPostalCode.Text,
Country = textBoxCountry.Text,
Phone = textBoxPhone.Text,
Fax = textBoxFax.Text
};
context.Customers.InsertOnSubmit(customer);
context.SubmitChanges();
}
}
しかし、私がそれを使用して書いてみると: context.Guides.
-InsertOnSubmit
メソッドが表示されません..誰かが理由を知っていますか?
ありがとう、ヨニ。