tags:

views:

1128

answers:

3

Hi All,

I started developing simple application in WPF and XAML.

I want to try accessign the sql server database and display the data from stored procedure onto the UI form.

I have a table called parentProject -> idParentProject (pk), txtParentProjName varchar(max). my SP is parentProj_sp -> select * from parentProject. n I want to use a dropdown list in which, If the sp returns say (3) records, then dropdownlist should have those 3 records retreived from sp.

similar manner, I have subproject -> idsubproject(pk), idParentProject , txtSubProjectName varchar(max), dateProjstart, dateprojectend.

once the parentprojectname is selected from first dropdown, then, subproject dropdown should be enabled and it should have the subprojectnames for the corresponding parent project.

my sp is subproject_sp -> SELECT dtProjectStart, dtProjectEnd FROM tblSubProject WHERE (idParentProject = @idProjectIndex).

please help me how to connect to database in C# using WPF and XAML.

Thank You, Ramm

A: 

You will want to combine two technologies. Data Acess and Data Binding. For Data Acess use one of Ado.Net, Linq2Sql, or what the rest of your group prefers.

Scott Weinstein
+1  A: 

1) Select the technology you want to use to access the database. (Hint: It's not WPF w/XAML)

2) Read the documentation for that particular technology.

3) Use the documented behavior to create your connection and do what you need to do.

4) Profit!

Your question clearly indicates that you don't understand the technology stack you're working with. You need to return to basics and grasp what WPF, XAML, and databases are, as well as how they interact.

Greg D
+1  A: 

Try ScottGu's great series on Linq to Sql which is probably the easiest way to get started IMHO. http://weblogs.asp.net/scottgu/archive/2007/07/16/linq-to-sql-part-5-binding-ui-using-the-asp-linqdatasource-control.aspx

Or for more in depth study http://msdn.microsoft.com/en-us/library/bb425822.aspx

David Rogers