binding webcontrol to a C# method that produces string with xml data

Discussion in 'ASP .Net' started by jason@cyberpine.com, Sep 22, 2006.

  1. Guest

    Below code:

    1. Is only returning one row.. and Im not sure why.
    2. I'd like to bind this result to an asp.net web control like
    datalist, but's not working. I guess my confusion is that Im trying to
    bind as a class object and not an xml file..
    3. finally, I was wondering, is there anyway in .net to bind a web
    control directly to webservice that is returning an xml file? How, if
    you dont know what the service might render, is this what they refer to
    as late binding?


    public static string Gogetit()
    {
    string conn = "Data

    Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\xx.mdf;Integrated
    Security=True;User Instance=True";
    using (SqlConnection connection = new
    SqlConnection(conn))
    {
    connection.Open();
    SqlCommand cmd = new SqlCommand("select * from book2 for
    xml path", connection);
    cmd.CommandType =
    CommandType.Text;
    XmlReader xr =
    cmd.ExecuteXmlReader();
    xr.MoveToContent();
    return(xr.ReadOuterXml());
     
    , Sep 22, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. alf
    Replies:
    3
    Views:
    297
    Lawrence D'Oliveiro
    Sep 27, 2006
  2. Replies:
    0
    Views:
    329
  3. dpapathanasiou
    Replies:
    6
    Views:
    1,051
    dpapathanasiou
    Oct 14, 2009
  4. Rémy Samulski

    String Array Property produces Parser Error

    Rémy Samulski, Jan 3, 2006, in forum: ASP .Net Building Controls
    Replies:
    5
    Views:
    173
    Mike MacMillan
    Jan 13, 2006
  5. naija naija

    Working with TreeView WebControl (binding with XML)

    naija naija, Sep 3, 2004, in forum: ASP .Net Web Controls
    Replies:
    5
    Views:
    282
    Teemu Keiski
    Sep 7, 2004
Loading...

Share This Page