We help IT Professionals succeed at work.

Windows CE 5.0 - Can I edit a datagrid or bind text fields to a dataset?

Last Modified: 2013-12-05
I've been developing a stock control system using VS2003 & MS SQL  2005.  Now I need to add the option to use Bar Code scanners.

The Bar Code Scanners are Windows CE5.0 devices with inbuilt wireless networking.  I have upgraded to VS2005 for this project as I understand its better suited to this task, so am also getting used to new environment.

I can build & deploy an app that reads direct from the MS SQL DB.  I've not installed SQL CE as I seem to be able to access the DB direct.  I can fill a datagrid with the contents of a table, so that's all fine.

I want to be able to update the DB.  The datagrid is editable, which I believe is the case - is that correct.  I have added Text Boxes to the form, but there does appear to be a datasource option.

Problem is, I'm just not sure I'm approaching this correctly.  Should I be installing SQL CE?  Is there an updatable datagrid option?  

I will be working in an environment where the wireless link may fail occassionally and so would like to store updates locally if no connection & then update in batch when I can get a connection.  That sounds to me like writing to a local dataset & then performing an update() as & when.  I guess I could create a form that adds / amends rows in the dataset & configure a data adapter to update the dataset - but is that the best approach.

I'm likely to be spending a lot of time in the near future on this project - so just after a 'heads up' really.  Am I on the right lines?  Any tips / advise greatly received.

Watch Question


After a little more testing, I've found I'm able to fill a dataset - so retrieving live data from the SQL server and use datagrid (or other controls) to view this and select a record.

I can create a form using Text Fields to display / edit data.  This aren't bound to the dataset but this can be done manually:

eg: Assuming I have a combobox with a data source of the Addresses table in my dataset and I just want to select an account from the drop down & then display / update the Full Name field.  If the Full Name is changed, then I press the Save button to save to dataset: (dataset is filled on load)

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        fld_FullName.Text = MyDataSet.Addresses.Item(ComboBox1.SelectedIndex).Item("Full_Name")
End Sub

Private Sub BtnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSave.Click
        MyDataSet.Addresses.Item(ComboBox1.SelectedIndex).Item("Full_Name") = fld_FullName.Text
End Sub

I can then use the dataadapter Update to write the changes to the dataset back to the SQL DB.  I can see this would work & isn't too much work to do (after all, its a windows CE device - the screens only big enough to display a handful of fields anyway!).

So, unless I hear otherwise, that's the approach I'll take.  However, I'd still be happy to hear from anyone who could either suggest a better way - or maybe just confirm that this is the right way.
Unlock this solution and get a sample of our free trial.
(No credit card required)

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.