Resolved Best way to assign an instance of a model to a SQL data table.

Jigabyte

New member
Joined
May 5, 2021
Messages
2
Programming Experience
10+
Hi,

I am currently learning C# so sorry if this is an easy one. I have created a model which matches a table in my SQL database. I have populated the model. How do I transfer the model to my database?

Model Customers
Table Customers.

I need to get the primary key of the new customer so I can add notes to a linked table.

Many thanks,
 

Skydiver

Staff member
Joined
Apr 6, 2019
Messages
5,712
Location
Chesapeake, VA
Programming Experience
10+
Moving to SQL section...
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
4,646
Location
Sydney, Australia
Programming Experience
10+
That depends. Are you using ADO.NET? Entity Framework? Some other ORM? It seems that you probably need to do some general reading on .NET data access and decide which way you're going to go, then look at the specifics of doing it that way.
 

Jigabyte

New member
Joined
May 5, 2021
Messages
2
Programming Experience
10+
That depends. Are you using ADO.NET? Entity Framework? Some other ORM? It seems that you probably need to do some general reading on .NET data access and decide which way you're going to go, then look at the specifics of doing it that way.
Thanks for the reply. It's a one off utility to import data from a spread sheet so I ended up using a data adapter a command builder to inject the data into my sql database.
 
Top Bottom