469,133 Members | 1,437 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,133 developers. It's quick & easy.

Parent/Child Datagrid

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

Feb 8 '07 #1
0 2162

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Ross | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Mortomer39 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.