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

Posted on 2007-10-10
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.

Question by:WestcountryBusiness
    LVL 1

    Author Comment

    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.

    Accepted Solution

    Because you have presented a solution to your own problem which may be helpful to future searches, this question is now PAQed and your points have been refunded.


    Featured Post

    Gigs: Get Your Project Delivered by an Expert

    Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

    Join & Write a Comment

    NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
    Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
    This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
    Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now