I am Working on Conecting to a database in windos forms C++. I use MVC++.
here is a link to my DB file so people can see what i have tried to do in the DB.
http://www.mediafire.com/?yfr52oqcknakk9g
you need access to see this.
i have finaly figured out how to make a connection to the database and put a table into a dataset and then put the data in the dataset into a combobox however what i dont know how to do is limit the data put in the combobox.
right not i have 3 combobox one called gravity another called temperature and my last one is called climate. there is 3 things i want to do. I want to take the data and put the text in the box (i can do that) but i want to limite what is put in there. I want it to put Heavy, Normal and Low into one combobox. Gas, Nox, Terran in another one and then the last 3 in the last box. i have put in the table all heavy type == 0 all temp type == 1 all climate type == 2.
i also have a thing called addonholder. i want that number to be stored with that text. so if someone was to selection Heavy, Terran, Frozen. it will look at the addonholder colume and times them togeather. to give you an output.
I am finging it hard to do this. I was origonly do this hard coded but decided to put it all into a database and slowing working through it all hehe :).
There is one other thing aswell. I want to be able to look at to tables I have put stuff in the database so it can link easier. I have another 6 boxes on my form so when heavy is seleted it will added in the terraforming section the same option in all 6 boxes. but when someone selects that option it will remove it from all the boxes and then added a new lvl to the boxes.
here is how i have coded the conection and the inserting to the combobox.
private:
OleDbConnection^ myConnection;
public:
CAadvanced(void)
{
InitializeComponent();
myConnection = gcnew OleDbConnection ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Users\\Jordan\\Documents\\Star Sonata\\CA_Data.mdb;Persist Security Info=False");
DataSet^ cadata = gcnew DataSet();
connectionOpen();
OleDbDataAdapter^ data = gcnew OleDbDataAdapter("SELECT t_planet_props.* FROM t_planet_props;", myConnection);
data->Fill(cadata);
connectionClose();
this->Temp->DataSource = cadata->Tables[0];
this->Temp->DisplayMember = "name";
//TODO: Add the constructor code here
//
}