I am trying to write a local program management and install system for my home network, and I think I've got the technologies nailed down:
- C#/.NET/WPF for the client
- Lua for installation scripting support (through LuaInterface)
- SQL Server Express for maintaining a database of programs
However I'm unsure what specifically I'll use to connect C# to the database. Is there something built into the .NET framework for this? Bonus points if you have a suggestion on what I should use for interacting with said database.
To connect to SQL Server Express you need nothing but
System.Data
, which is a standard .NET assembly. Just useSqlXXX
classes and you'll be done.However, writing mundane ADO.NET code is very boring, so it's very common to use an ORM or less heavy-weight result-set mapper such as BLToolkit.
And finally, consider using SQL Server CE. This is a fully ACID-compliant single-file embedded database engine which supports pretty much any feature you can expect form an SQL RDBMS.
Currently the easiest way to connect to your database and perform queries in C# is LinqToSQL. It will save you a lot of headache as compared to using "old-school" ADO connections.
SqlConnection
object is made for this.
Eg:
or
Edit:
After doing all your stuff you have to close the connection by
Data Source: Identifies the server. Could be local machine, machine domain name, or IP Address.
Initial Catalog: Database name.
Integrated Security: Set to SSPI to make connection with user's Windows login
User ID: Name of user configured in SQL Server.
Password: Password matching SQL Server User ID.
Sure of course, you can just use the classes in System.Data.SqlClient, though most people will use an ORM. I use LLBLGen Pro.
I wish this will help just try these..
@CLASS
@LOGIN
@MAIN ACCESS
You can use ADO.Net and System.Data.SqlClient namespace for the same. I will advise you to go with Entities framework (ORM). Please find below links for Entity Framework walk through
http://thedatafarm.com/LearnEntityFramework/tutorials/creating-an-ado-net-entity-framework-entity-data-model/
http://thedatafarm.com/LearnEntityFramework/tutorials/use-an-entity-framework-entity-as-a-winforms-data-source/