Answered by:
Are the table relationships recognized from SQL Server when I link Visual Studio to my SQL Server Dataset?

Question
-
User-1546303928 posted
Hi,
As you can probably tell, I'm brand new to Visual Studio and SQL Server Datasets. I am creating a SQL Server db with about 7 tables and their applicable relationships. I want to create the user forms in VB.NET with Visual Studio. When I connect VS to my SQL Server database, are the relationships recognized by VS or do I have to use the GUI in VS to reestablish them?
Thank you,
- Justin
Wednesday, October 31, 2018 7:27 AM
Answers
-
User1724605321 posted
Hi Justair07,
You can use Entity Framework Database First :
https://docs.microsoft.com/en-us/ef/ef6/modeling/designer/workflows/database-first
Database First allows you to reverse engineer a model from an existing database. The model is stored in an EDMX file (.edmx extension) and can be viewed and edited in the Entity Framework Designer and shows the relationship .
Best Regards,
Nan Yu
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, November 1, 2018 1:58 AM
All replies
-
User753101303 posted
Hi,
What you are doing is not crystal clear. If using https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/dataset-datatable-dataview/typed-datasets it is outdated. Try "Entity Frramework" (EF) instead or another "ORM" product (whose purpose is to expose db data as .NET objects).
Wednesday, October 31, 2018 7:15 PM -
User1724605321 posted
Hi Justair07,
You can use Entity Framework Database First :
https://docs.microsoft.com/en-us/ef/ef6/modeling/designer/workflows/database-first
Database First allows you to reverse engineer a model from an existing database. The model is stored in an EDMX file (.edmx extension) and can be viewed and edited in the Entity Framework Designer and shows the relationship .
Best Regards,
Nan Yu
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, November 1, 2018 1:58 AM -
User-1546303928 posted
PatriceSc and Nan Yu,
Thank you both for the reply. As you can probably tell from my question, I'm embarking on a new journey by making by first non-access db.
Patrice, you are correct, from my research (which I can now see was outdated) I planned to use typed datasets in my project.
Nan Yu,
You link was awesome. I'm going to do some research/training on Entity Framework Designer before I begin. I'll start with the video in the link :)
So correct me if I'm wrong, by using EFD in my project I won't need stuff like:
Imports System.Data.SqlClient Module MyFirstProject
Public str As String
Public con As New SqlConnection(str)
Public cmd As SqlCommand
Public da As SqlDataAdapter
Public ds As DataSet
Public bs As BindingSource
Public qry As String
Public Function GetConString() As String
Return "Data Source=MyFirstProject\SQLEXPRESS;" &
"Initial Catalog=Projects;" &
"Integrated Security=True;" &
"MultipleActiveResultSets=True"
End FunctionAlso, what about moving my DB location? I plan to develop my DB in SQL Express on my personal PC but then I need to move it to a LAN Server after testing and project completion.
Thanks again,
- Justin
Thursday, November 1, 2018 1:27 PM