Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. Databinding in Silverlight with databases other than with SQL Server

Databinding in Silverlight with databases other than with SQL Server

Scheduled Pinned Locked Moved WPF
questioncsharpdatabasec++css
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pisanis
    wrote on last edited by
    #1

    Hi, I am evaluating Silverlight as a UI for a new application and I'm looking for some advice. I'm fairly new to Silverlight. Background: I am working with a database that provides it's own ADO.NET native adapter. Using this native provider, I can define ADO.NET Commands ith SQL Statements and run ExecuteQuery methods against the database to retrieve datasets. This all works fine when building a traditional client/server thick client. Now to Silverlight.... I am of the understanding that Silverlight (any version) will need to call a WCF web service (typically hosted by a ASP.NET Web application on a web server somewhere) right ?. A proxy class built on the Silverlight side is what is used to drive the web service, and controls are bound to this class. I have managed to build a simple Silverlight application that takes the input of two integers and displays the sum. This is done by calling an AddIntegers web method exposed by the web service, which returns the sum as a result. So far so good. However ... How do I go about gettings rows of information, like, a resultset from my database and into SL ? Within by web method (say, ContactNames()), I can execute ADO.NET type commands to interact with my remote database, but once I get that dataset, I do not know how to return it to silverlight for populating into a grid... Any help would be greatly appreciated, articles, sample code, .. anything ... Thanks

    M M M 3 Replies Last reply
    0
    • P pisanis

      Hi, I am evaluating Silverlight as a UI for a new application and I'm looking for some advice. I'm fairly new to Silverlight. Background: I am working with a database that provides it's own ADO.NET native adapter. Using this native provider, I can define ADO.NET Commands ith SQL Statements and run ExecuteQuery methods against the database to retrieve datasets. This all works fine when building a traditional client/server thick client. Now to Silverlight.... I am of the understanding that Silverlight (any version) will need to call a WCF web service (typically hosted by a ASP.NET Web application on a web server somewhere) right ?. A proxy class built on the Silverlight side is what is used to drive the web service, and controls are bound to this class. I have managed to build a simple Silverlight application that takes the input of two integers and displays the sum. This is done by calling an AddIntegers web method exposed by the web service, which returns the sum as a result. So far so good. However ... How do I go about gettings rows of information, like, a resultset from my database and into SL ? Within by web method (say, ContactNames()), I can execute ADO.NET type commands to interact with my remote database, but once I get that dataset, I do not know how to return it to silverlight for populating into a grid... Any help would be greatly appreciated, articles, sample code, .. anything ... Thanks

      M Offline
      M Offline
      Mike Marynowski
      wrote on last edited by
      #2

      Typically you will want to exchange strongly typed classes. So, have your web method return List<Customers> (or whatever else you need), and then populate that data into a grid using data templates in Silveright. A google search for silverlight data templates will get you what you need on that end.

      modified on Friday, August 7, 2009 1:27 PM

      1 Reply Last reply
      0
      • P pisanis

        Hi, I am evaluating Silverlight as a UI for a new application and I'm looking for some advice. I'm fairly new to Silverlight. Background: I am working with a database that provides it's own ADO.NET native adapter. Using this native provider, I can define ADO.NET Commands ith SQL Statements and run ExecuteQuery methods against the database to retrieve datasets. This all works fine when building a traditional client/server thick client. Now to Silverlight.... I am of the understanding that Silverlight (any version) will need to call a WCF web service (typically hosted by a ASP.NET Web application on a web server somewhere) right ?. A proxy class built on the Silverlight side is what is used to drive the web service, and controls are bound to this class. I have managed to build a simple Silverlight application that takes the input of two integers and displays the sum. This is done by calling an AddIntegers web method exposed by the web service, which returns the sum as a result. So far so good. However ... How do I go about gettings rows of information, like, a resultset from my database and into SL ? Within by web method (say, ContactNames()), I can execute ADO.NET type commands to interact with my remote database, but once I get that dataset, I do not know how to return it to silverlight for populating into a grid... Any help would be greatly appreciated, articles, sample code, .. anything ... Thanks

        M Offline
        M Offline
        Mark Salsbery
        wrote on last edited by
        #3

        pisanis wrote:

        I am of the understanding that Silverlight (any version) will need to call a WCF web service

        You don't have to use WCF. For example a plain old XML (POX) web service could be used. Silverlight can bind directly to the returned XML or if necessary you could convert the returned XML to an object or collection of objects using perhaps LINQ to XML. *edit* Oops - drifted into WPF Land there :)

        pisanis wrote:

        How do I go about gettings rows of information, like, a resultset from my database and into SL ?

        pisanis wrote:

        once I get that dataset, I do not know how to return it to silverlight

        There's a variety of ways to accomplish this. If you choose to use WCF, you could return a collection of objects of a class that represents a row of data. You would convert dataset rows to this collection of objects, perhaps using LINQ to DataSet. You may also want to look into .NET RIA Services, which is still in development and will probably be officially part of .NET 4, but there is a preview version[^] available which is now licensed to use live.

        Mark Salsbery Microsoft MVP - Visual C++ :java:

        modified on Friday, August 7, 2009 1:30 PM

        1 Reply Last reply
        0
        • P pisanis

          Hi, I am evaluating Silverlight as a UI for a new application and I'm looking for some advice. I'm fairly new to Silverlight. Background: I am working with a database that provides it's own ADO.NET native adapter. Using this native provider, I can define ADO.NET Commands ith SQL Statements and run ExecuteQuery methods against the database to retrieve datasets. This all works fine when building a traditional client/server thick client. Now to Silverlight.... I am of the understanding that Silverlight (any version) will need to call a WCF web service (typically hosted by a ASP.NET Web application on a web server somewhere) right ?. A proxy class built on the Silverlight side is what is used to drive the web service, and controls are bound to this class. I have managed to build a simple Silverlight application that takes the input of two integers and displays the sum. This is done by calling an AddIntegers web method exposed by the web service, which returns the sum as a result. So far so good. However ... How do I go about gettings rows of information, like, a resultset from my database and into SL ? Within by web method (say, ContactNames()), I can execute ADO.NET type commands to interact with my remote database, but once I get that dataset, I do not know how to return it to silverlight for populating into a grid... Any help would be greatly appreciated, articles, sample code, .. anything ... Thanks

          M Offline
          M Offline
          Michael Sync
          wrote on last edited by
          #4

          The most of your questions are already answered by our Codeproject Silverlight Experts. I will just add one more point here. If you really want to return the DataSet from Service then you may want to check-out the code written by one of our Silverlight community members. The link for that is here[^]. But returning the dataset from service is not a good idea but the most of .NET developers who are familiar with .NET 1.1 and 2.0 still prefer to use DataSet. Another thing is that DataSet will not be supported in Silverlight.

          Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) Microsoft MVP (Silverlight), WPF/Silverlight Insiders

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups