i would like to perform a double select query from a single table and create a stored procedure with it to fill a dataset like ds.Table[0].rows for first select query and ds.Table[1].rows for second select query in a foreach loop. below is select query i tried which gives me error saying:
"Operand should contain 1 column(s)"
SELECT DISTINCT a.profileID, b.feat_name
FROM t_perm a, t_features b
WHERE a.featureID = b.featureID AND a.profileID = 1
IN
(SELECT DISTINCT a.ActionID, b.Act_name
FROM t_perm a, t_actions b
WHERE a.ActionID = b.ActionID)
c# code for dataset and foreach loop
cmd.Parameters.AddWithValue("@pprofileID", Convert.ToInt64(profileID));
MySqlDataAdapter mySqlDataAdapter = new MySqlDataAdapter(cmd);
DataSet dk = new DataSet();
mySqlDataAdapter.Fill(dk);
cmd.ExecuteNonQuery();
// kryptonDataGridViewFeature.DataSource = dk.Tables[0];
int iRow = 0;
//first select query
foreach (DataRow row in dk.Tables[0].Rows)
{
string strFeatureName;
strFeatureName = row["feat_name"].ToString();
if (strFeatureName == "client registration")
{
clientToolStripMenuItem.Enabled = true;
}
}
//second select query
foreach (DataRow row in dk.Tables[1].Rows)
{
}
iRow = iRow + 1;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
Aucun commentaire:
Enregistrer un commentaire