1

I'm trying to learn LINQ to SQL but having a very difficult time. I ultimately want to have a form that I can add 3 fields to a table, and then call those entries back and store in variables for use. I started my Windows Form Project and added 3 text boxes, and a button that I will have save the values to the database.

I "Added a new connection", Named the Connection, Added a new table on the new connection, Added the Column names, And saved the Table. (I couldn't figure out how to format this better so all the pictures for what I did are below).

Now I see my "TestTable" in the Server Explorer, but I don't know how to use it. How do I get that table from my server explorer to a point that I can Insert, Edit, Delete entries into it. I've seen lots of threads about how to do the actual insert, edit, and delete part, but I'm missing the critical information of how I associate with it. Is it something like creating an object of a class?

//example
ClassTest newTestObject = new ClassTest(); 

enter image description here enter image description here enter image description here enter image description here enter image description here

enter image description here

1 Answer 1

2

You need to add .dbml (Add new Item + LINQ to SQL Classes), drag table object from server explorer and drop it to dbml sheet. Take a look at tutorial and MSDN article.

Sign up to request clarification or add additional context in comments.

1 Comment

That was exactly what I needed. Thank you for those links.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.