I have created a generic method which would take the _query string, obj of datagridview, tablename, obj of dataset_ as shown below
I am calling this method on different buttons as the are clicked, by passing different parameters. shown below is an example of how its being called.
Now, the problem is, Its displaying for once, I mean- When `button1` is clicked its displaying the appropriate results.
But,when `button2` is clicked which has parameters as followed,
its creating an exception: <br/>
`"At most one record can be returned by this subquery"` at `data(definitio n)>dAdapter.Fil l(dgset);`
**Note:**
Let me tell u the problem is not with the query, since `button1` is also passing the query which has _sub-queries_ too.
I am aware that the problem is about `unloading` the resources in `datagridview`, `dataset` and `reloading` it.
But, I have tried a lot and couldn't find the solution.
Any help would be appreciated.
Code:
private void data(string dgvq, DataGridView dgvw, string sTableNm, DataSet dgset) { createconn(); dgset.Clear(); dAdapter = objADOUI.GetDataAdapter(dgvq, myConn); dAdapter.Fill(dgset); dgvw.DataSource = dgset.Tables[0].DefaultView; this.myConn.Close(); }
I am calling this method on different buttons as the are clicked, by passing different parameters. shown below is an example of how its being called.
Code:
DataSet dset1 = objADOUI.GetDataSet(); data(Qdgv, dgvDpnl, "TStudent", dset1);
But,when `button2` is clicked which has parameters as followed,
Code:
DataSet dset2 = objADOUI.GetDataSet(); data(Qdgv, dgvDpnl, "TStudent", dset2);
`"At most one record can be returned by this subquery"` at `data(definitio n)>dAdapter.Fil l(dgset);`
**Note:**
Let me tell u the problem is not with the query, since `button1` is also passing the query which has _sub-queries_ too.
I am aware that the problem is about `unloading` the resources in `datagridview`, `dataset` and `reloading` it.
But, I have tried a lot and couldn't find the solution.
Any help would be appreciated.
Comment