Databases Using Entity Framework
SQL Server Interaction Using Entity Framework
The Entity Framework is currently Microsoft's recommended method of interacting with databases in the .NET framework. Performing a web search on Entity Framework will return a lot of tutorials and examples.
This Walk-Through will give a very simple example of the database first method. It is assumed an SQL Server Database already exists.
1) Open AdvancedHMI with Visual Studio
2) In Solution Explorer, right click the AdvancedHMI project and select Add->New Item (Ctrl+Shift+A)
3) In the left pane under Common Items, select Data
4) In the center pane select ADO.NET Entity Data Model
5) Give the name of MyDbModel and click the Add button
6) A Wizard will pop up. Select EF Designer from Database and click the Next button
7) Click the New Connection button
8) You will now need to enter the information related to your specific server and database instance
9) Click OK when finished selecting the database
10)
11) Give the name MyDbModel
Using db As New LW5Entities
Dim MyDbRecord As new MyDbTable
MyDbRecord.Field1="New test Record"
db.MyDbTables.Add(MyDbRecord)
db.SaveChanges
End Using