Hi, I'm looking for a way to retireve a subset from a sql-table. I have several key-value fields in the application which I store in one table. When I want to use the DataGridView in combination with a ComboBox I have to bind the ComboBox with a DataTable. MM doesn't support an overload for the GetAllData() method. I designed the (test) method below in the DomainRef class to populate the comboboxes. It works but I think there has to be better ways...
public DataTable GetAllData2(int DomainID)
{
string cnStr;
cnStr = mmAppBase.DatabaseMgr.GetConnectionString("BinaDB");
using (SqlConnection cn = new SqlConnection(cnStr))
{
SqlCommand cmd = new SqlCommand("SELECT * FROM DomainRef WHERE DomainID = " + DomainID.ToString() , cn);
SqlDataAdapter adpt = new SqlDataAdapter(cmd);
DataTable dtStuff = new DataTable("stuff");
adpt.Fill(dtStuff);
return dtStuff;
}
}
gr leon