I’m pretty familiar with SQL syntax (via MySQL) and am just getting my feet wet with C# and SQL server.
I currently have a .sdf database on my C:\ drive and want to connect to it in C#.
I added the database as a data source and now need help figuring out how to get data from the database in my C# application.
I just want to be able to set an object to the data in my SQL database so I can manipulate it using C#.
Thanks in advance for replies.
A
*.sdffile means you’re using Compact Edition. That’s a little different – more analogous to an Sqlite or Access style database than MySql or a full Sql Server.As to the rest of it, there are as nearly many ways to do that as there are programmers. However, most of them at some level will involve the
System.Data.SqlCenamespace, which is where the Sql Server Compact Edition data provider lives. If you decide to move up to a full Sql Server edition, like Sql Server Express (still free), you would instead use theSystem.Data.SqlClientnamespace.Additionally, I want to focus on your specific statement:
That sounds like you’re really just interested in an ORM (Object/Relational Mapper). I can’t comment on how well specific ORMs work with Sql Server Compact Edition, but now that you know what you’re looking for you should be able to conduct your own search.