InvalidArgument=Value of '3' is not valid for 'rowIndex'
Posted
by Devendra Dwivedi
on Stack Overflow
See other posts from Stack Overflow
or by Devendra Dwivedi
Published on 2009-03-27T18:08:44Z
Indexed on
2010/06/07
4:42 UTC
Read the original article
Hit count: 387
c#
Hi all
This is my code It is working for if 1 terminal that is having 3 services but it is not working for more than 3 services when I do then I have got following error message:
InvalidArgument=Value of '3' is not valid for 'rowIndex'
I have so tired to find this problem but couldn't get any solutions. Anybody please help me.
MySqlCommand command = new MySqlCommand("VTerminalsLoad");//Procedure
MySqlDataAdapter terminalAdapter = this.Database.ExecuteCommand(command);
terminalAdapter.Fill(dataSet, "Terminals");
command = new MySqlCommand("VTServicesLoad");//Procedure
command.Parameters.Add(new MySqlParameter("pVesselID", 1));
MySqlDataAdapter serviceAdapter = this.Database.ExecuteCommand(command);//Return Adaptor
serviceAdapter.Fill(dataSet, "Services");
DataColumn[] parentColumns = { dataSet.Tables[0].Columns["SerialNo"],
dataSet.Tables[0].Columns["VesselID"],
dataSet.Tables[0].Columns["TerminalID"] };
DataColumn[] childColumns = { dataSet.Tables[1].Columns["SerialNo"],
dataSet.Tables[1].Columns["VesselID"],
dataSet.Tables[1].Columns["TerminalID"] };
DataRelation relationTS = new DataRelation("TerminalsServices", parentColumns, childColumns);
dataSet.Relations.Add(relationTS);
//Parent Table
ListTerminal.DataSource = dataSet; //ListTerminal Parent datagridview
ListTerminal.DataMember = "Terminals";
//Child Table
ListServices.DataSource = dataSet;// ListServices Child datagridview
ListServices.DataMember = "Terminals.TerminalsServices";
© Stack Overflow or respective owner