Parent/Child Datagrid

I

Iain

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top