[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.odbcnet

putting values in 2 data grids

Robin Prosch via .NET 247

6/9/2004 8:12:00 AM

Hi =2E=2E
please see the code below=2E=2E
I have two tables Centrals and Devices both having Central_Id as=
a common field=2E=2EI am able to display the Centals table value in=
the first datagrid (dataGirdCentral)=2EHowever on click of each=
cell on the central_id i want the corresponding entries of=
Devices table to be shown in the 2nd datagrid=
dataGridDevices=2E=2Ehow do i do that=2E=2E=2E

private void loadCentralDevices()
{
ds =3D new DataSet();
//Getting schema of Centrals table
DataTable centralDt =3D new DataTable("Centrals");
String query =3D "Select * from Centrals";
OleDbDataAdapter da =3D new=
OleDbDataAdapter(query,ConfigurationSettings=2EAppSettings["MsAcce=
ss_ConnectString"]);
da=2EFillSchema(centralDt, SchemaType=2ESource);
ds=2ETables=2EAdd(centralDt);


//Getting schema of Devices table
DataTable deviceDt =3D new DataTable("Devices");
String query1 =3D "Select * from Devices";
da =3D new=
OleDbDataAdapter(query1,ConfigurationSettings=2EAppSettings["MsAcc=
ess_ConnectString"]);
da=2EFillSchema(deviceDt,SchemaType=2ESource);
ds=2ETables=2EAdd(deviceDt);

DataRelation dr =3D new DataRelation("Central_Devices_Relation",
centralDt=2EColumns["Central_ID"], deviceDt=2EColumns["Central_Id"]);=

ds=2ERelations=2EAdd(dr);

//create a dataview of the data
DataView centralVw =3D new DataView(ds=2ETables["centralDt"]);
//giving access to Centrals table
centralVw=2EAllowDelete=3Dtrue;
centralVw=2EAllowEdit =3D true;
centralVw=2EAllowNew =3D true;
//set the grid source to the author view
dataGridCentral=2EDataSource =3D centralVw;
//hook up the event handler
dataGridCentral=2ECurrentCellChanged+=3D new=
EventHandler(this=2EdataGridCentral_CellChanging);

}


private void dataGridCentral_CellChanging(object sender,=
EventArgs eArgs)
{
????? what do i write here to get the corresponding values?
}

-----------------------
Posted by a user from =2ENET 247 (http://www=2Edotnet247=2Ecom/)

<Id>9VDPWIelyU+7E7vJzdd9NA=3D=3D</Id>