Thread: C# ->wpf

  1. #1
    Registered User
    Join Date
    Mar 2012
    Posts
    3

    Unhappy C# ->wpf

    I was created login form using WPF application in c# but still i haven't any idea about its database connection, i was tested many methods but these methods are not possible.Please any one have any idea about this please give me a better solution for that thanks ,because i wasted lot of time for that but still i haven't solution, please give me a good method for implement database connection.
    thanks

  2. #2
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    It would be impossible to give you a solution on how to implement a database in one thread. However if you have SQL Server 2008 R2 Express there are several websites that will show you how to set this up. Note that it is actually a bit more difficult to setup SQL express than actual SQL. Once you get SQL server up and running as a service you will then need to download SQL Server Management Studio (SSMS) which is not included with SQL Server 2008 Express. Search MSDN for this download and you will find it pretty quickly. Once you have that running you need to create a new database in SSMS and add at least 1 table. For the logon in SSMS just use Windows Authentication. Now once you have that you can open up MSVS 2010 express and go to the server explorer. Right click and add a connection. Use the same settings you did to logon to SSMS and the server should appear.

    Now comes the interesting part. What you do next depends on if you are going to use ADO .NET, Entity Framework, etc. For ADO .NET all you need to do is click on the server in server explorer and in the properties it will show you the connection string. Copy this connection string and either use it directly in your calls via SqlConnection (System.Data.SQLClient) or put it in the app.config and reference it from there. Once you have a database up and running and you can connect to it you can add a new dataset to your project. Right click->Add new item->Data->Dataset. Now drag one of your tables from the database over to your dataset designer. If you do not need the tableadapter delete it as all datasets in MSVS by default have table adapters.

    From here on out it is basic ADO, LINQ to SQL, or LINQ to Entities that will get you going. I certainly cannot explain all of those in detail in one post. Database clients are usually multi-tiered apps that have many different pieces to them. But for a simple local database this should get you going. For more complex scenarios you will need SQL Server, and IIS. There is a IIS Express available and you can do ASP .NET and Silverlight apps with Web Developer Express but you will still be limited as to what you can do.

    Note that I do not think that SQL Express supports anything other than a local database which makes it a bit limiting. You can somewhat get by this via ASP .NET but again I cannot explain all of that in one post.

    I would recommend purchasing some books on ADO .NET, C# and the .NET 4.0 Framework, WPF, ASP .NET, Entity Framework, SQL, WCF and on relational databases in general. Note that the line of books related to achieving MCPD (Exam preps for 70-511, 70-516, 70-518, etc.) serve as a good starting point for these technologies.
    Last edited by VirtualAce; 03-24-2012 at 10:29 AM.

  3. #3
    Registered User
    Join Date
    Mar 2012
    Posts
    3
    thanks now i see your post i will try to connect database using ADO.NET thank for your reply actually its very helpful for me thanks again think you will help me again

Popular pages Recent additions subscribe to a feed

Tags for this Thread