SQL server compact 3.5 view data problem RRS feed

  • Question

  • Hi I have created 2 functions one to add some data and the second to get the data from a sql compact 3.5 database on my phone. I beleive that the function to add data works because when i created a from and then linked a list box to the dataset the newly added record would be shown but when i use the second function (to retreive a datareader its hasrows property is false.

    below is my code:


    public static int addEvent(String eventName, String eventDescription, DateTime eventTime, Double eventLongitude, Double eventLatitude, Double eventSpeed)
                ontimeDataSetTableAdapters.eventsTableAdapter eventsTableAdapter = new OnTime.ontimeDataSetTableAdapters.eventsTableAdapter();
                ontimeDataSet.eventsDataTable eventsTable = new ontimeDataSet.eventsDataTable();
                eventsTableAdapter.ClearBeforeFill = true;

                return eventsTableAdapter.Insert(eventName, eventDescription, eventTime, eventLongitude, eventLatitude, eventSpeed, true);

            public static System.Data.DataTableReader getEvents()
                ontimeDataSet.eventsDataTable eventsTable = new ontimeDataSet.eventsDataTable();

                return eventsTable.CreateDataReader();

    ***END CODE***

    so can you see anything silly that I have missed out? I am really guessing the code because I cannot find a good example anywhere. is there a better way to get the data from my datatable? I dont like the way i seem to be creating a new table

                       ontimeDataSet.eventsDataTable eventsTable = new ontimeDataSet.eventsDataTable();

    instead of obtaining the actual table or directly getting a reader from it. (does the method i have used here make a copy of the current table? if so do i then need to accept changes in the first code block for the generated table to copy any new data?)

    Thursday, August 20, 2009 5:10 PM


All replies