Parent/Child Datagrid

Discussion in 'ASP .Net' started by Iain, Feb 8, 2007.

  1. Iain

    Iain Guest

    Hi All

    My apologies for posting this here but the Delphi newsgroup is very
    slow.

    Using Borland Developer Studio 2006 - creating a C# .net application.

    I have a datagrid (id = "Documents") on a form with a button (a test
    app at this point).
    In the button event I have the following code which I would like to
    populate the datagrid
    with Parent Child data relationship records. When I compile this I get
    a couple of errors.
    Here is the code with error points indicated

    OleDbConnection conoper = new OleDbConnection("provider=IBMDA400;Data
    Source=XXX.XXX.XXX.XXX;User Id=XXXXXXXXXX;password=XXXXXXXXXX");
    OleDbCommand cmdoper = new OleDbCommand();

    DataSet ds = new DataSet();

    string LSqlString1 = "Select DOCNAME, CELL, WORKSTATN, PRODUCT,
    DOCCAT, DOCPATH, SUBMITDATE, SIGNEDOFF From WRKINSTRUC.SIGNOFFDOC";
    conoper.Open();
    cmdoper.Connection = conoper;
    cmdoper.CommandType = CommandType.Text;
    cmdoper.CommandText = LSqlString1;
    OleDbDataReader dsParent = cmdoper.ExecuteReader();
    conoper.Close();

    string LSqlString2 = "Select DOCNAME, CELL, WORKSTATN, PRODUCT,
    DOCCAT, DOCPATH, SUBMITDATE, SIGNEDOFF From WRKINSTRUC.SIGNOFFDOC";
    conoper.Open();
    cmdoper.Connection = conoper;
    cmdoper.CommandType = CommandType.Text;
    cmdoper.CommandText = LSqlString2;
    OleDbDataReader dsChild = cmdoper.ExecuteReader();
    conoper.Close();

    /* from here I am winging it */

    /*
    Compile problem here indicating datasources do not have Fill
    definitions
    [C# Error] WebForm1.aspx.cs(75): 'System.Data.OleDb.OleDbDataReader'
    does not contain a definition for 'Fill'
    */

    dsParent.Fill(ds, "Parent");
    dsChild.Fill(ds, "Child");

    /* additional compile messages
    [C# Error] WebForm1.aspx.cs(78): No overload for method 'this' takes
    '5' arguments
    */
    ds.Relations.Add("UnsignedDocuments",
    ds.Tables["Parent"].Columns["DOCNAME", "CELL", "WORKSTATN", "PRODUCT",
    "DOCCAT"],
    ds.Tables["Orders"].Columns["DOCNAME", "CELL",
    "WORKSTATN", "PRODUCT", "DOCCAT"]);

    Documents.DataSource = ds;
    Documents.DataMember = "Docs";

    Has anyone any ideas on how I rectify this problem ?

    Or am I way Off beam :)

    Many thanks in advance for any assistance offered

    Iain
     
    Iain, Feb 8, 2007
    #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. davout
    Replies:
    0
    Views:
    563
    davout
    Apr 18, 2004
  2. Jeff Rodriguez
    Replies:
    23
    Views:
    1,163
    David Schwartz
    Dec 9, 2003
  3. Replies:
    0
    Views:
    218
  4. Noel Dolan
    Replies:
    0
    Views:
    250
    Noel Dolan
    Jul 18, 2004
  5. Bitswapper
    Replies:
    5
    Views:
    163
    Prasad, Ramit
    Aug 27, 2013
Loading...

Share This Page