Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>Q1</strong>:<br> This is a fairly roundabout way maybe, but this is how i do it for a combobox:</p> <ol> <li><p>Create a dataset for the database (when i added my sqlce db, i chose to add a dataset during the wizard that automatically popped up)</p></li> <li><p>Open your dataset by doubleclicking on it</p></li> <li><p>From your "Server Explorer", create your tables &amp; edit your data as needed, then drag &amp; drop your table/s to the dataset designer</p></li> <li><p>Open your windows form's design view and from your "Data Sources" (which should have your dataset in it), drag &amp; drop some fields that you'd want to display for this table on to your form (e.g. name, surname, age, gender, etc). Visual Studio will then auto-add the following objects (visible on the bottom of your design view): dataset, bindingsource, table adapter and a table adapter manager.</p></li> <li><p>Now add your Combobox that you want to bind to this table (e.g "cboName")</p></li> <li><p>In code-behind in the Form_Load event, bind it as follows: cboName.DataSource = myTableBindingSource; cboName.DisplayMember = "Name"; //will bind to the "Name" column</p></li> </ol> <p>That should be it. Now when the app runs you'll be able to select the people by name from the combobox and their details will show accordingly in the other controls you dropped on the form. I'm still very new to this, so there might be better ways. But this works for me so far :). Unfortunately i'm not sure what a model container is.</p> <p><strong>Q2:</strong><br> I'm not sure about edmx database models. My database is an sdf file, my dataset is an xsd file and i edit my database through the Server Explorer.</p> <p>...However VERY important to know is that your "designed" database is not the db your app is using in runtime. Go check your bin folder - in there you'll find the db your app runs with. (With SQLCE the database in design is seperated from the db used and you have to manually update (copy-paste overwrite) your db in the bin folder after changes made in your design or data).</p> <p>Take note that your "data sources" is like a map to your database. You'll have to update (drag-dropping your table again)... or recreate, etc. the data source (e.g. your dataset) if your db changes doesn't reflect on it.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload