Hi! I'm very new to C#, so please forgive me if I've overlooked something here. I've created a database using Visual Studio (add new item > service-based database) called LoadForecast.mdf. I then created a table called ForecastsDB and added some fields. My main question is this: I've created a console application with the intention of writing some data to the newly created database. I've added LoadForecast.mdf as a data source for my program, but is there anything else I should do? I saw an example where the next step was adding a "data diagram", but this was for a visual application, not a console application. Do I still need to diagram the database for my console app? I just want to be able to write new records out to my database table and wasn't sure if there were any other things I needed to do for the VS environment to be "aware" of my database. Thanks for any advise!
views:
60answers:
1
+2
A:
Well, it depends on what data access technology you want to use. You can use straight SqlClient, you can use untyped data sets, you can use strongly typed data sets, you can use LINQ to SQL, you can use Entity Framework.
If you're not sure, then probably the most fun would be LINQ to SQL, so I recommend you follow a tutorial first and then come back to your app. Eg. ScottGu's LINQ to SQL (Part 4 - Updating our Database), or MSDN's How to: Insert Rows Into the Database.
There are also video guides, like VS2008 Training Kit: Using LINQ with Relational Data or MSDN Webcast: Using LINQ with Relational Data (Level 100).
Remus Rusanu
2010-04-01 05:04:47
Thanks a lot! I'll check out those links now. I greatly appreciate it!
Kevin
2010-04-01 05:20:54