Я пытаюсь вставить данные через концепцию linq to sql. я записал код, как это. здесь клиенты - это имя таблицы, в которую я хочу вставить данные. Как этого добиться?
следующий код не работает. Как вставить данные через эту концепцию.
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
Dim context As New linq_to_sql_classesDataContext
Dim custid As New Customer
custid.CustomerID = Trim(txt_custid.Text)
custid.CompanyName = Trim(txt_companyname.Text)
custid.ContactName = Trim(txt_contactname.Text)
custid.ContactTitle = Trim(txt_contacttitle.Text)
custid.Address = Trim(txt_address.Text)
custid.City = Trim(txt_city.Text)
custid.Region = Trim(txt_region.Text)
custid.PostalCode = Trim(txt_postalcode.Text)
custid.Country = Trim(txt_country.Text)
custid.Phone = Trim(txt_phone.Text)
custid.Fax = Trim(txt_fax.Text)
context.Customers.Attach(custid)
context.SubmitChanges()
End Sub
Спасибо