Pocket PC Addict Forums



» BoxWave
BoxWave Corporation
» More Resources

Welcome to the Pocket PC Addict Forums!

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, download files, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Go Back   Pocket PC Addict Forums > Software > Windows Mobile 6

view more in our Photo Gallery...

Windows Mobile 6 Anything problems, tips, or tricks on WM 6

Reply
 
Thread Tools Display Modes
  #1  
Old 01-17-2008, 12:44 AM
Shanker's Avatar
Shanker Shanker is offline
Junior Member
Pre-Addict
 
Join Date: Jan 2008
Device: i-mate Jas
Posts: 3
Downloads: 0
Uploads: 0
Windows Mobile 6 - Data Application Error

Hi,

I need a little bit of help on Windows Mobile 6 platform.
I am developing a database driven application using C# and SQL Server CE (Visual Studion 2005, .NET Framework CE 2.0 SP1). This application will be using the Remote Data Access concept. I seem to be able to pull data from the database server, but the device (PDA) stops responding when I try to enter a new record in the local database (.sdf). I can't seem to find a problem in logic or the code. Hope you guys can help. I have pasted the code at the end of this thread.

regards,

Shanker

Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlServerCe;
using System.IO;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace RDA
{
    public partial class MainForm : Form
    {
        string rdaOledbCon = @"Provider=SQLOLEDB.1;Persist Security Info=False;User ID=MobileUser;Initial Catalog=WinMobile6;Data Source=192.168.1.107;Password=123456";
        string rdaURL = @"http://192.168.1.16/SqlMobile/sqlcesa30.dll";
        string localDeviceCon = @"Data Source=\My Documents\RdaDB.sdf";

        public MainForm()
        {
            InitializeComponent();
        }

        private void mnuRDAPull_Click(object sender, EventArgs e)
        {
            RDAPull();
        }

        private void RDAPull()
        {
            try
            {
                if (File.Exists("\\My Documents\\RdaDB.sdf"))
                    File.Delete("\\My Documents\\RdaDB.sdf");

                SqlCeEngine ceEngine = new SqlCeEngine();
                ceEngine.LocalConnectionString = localDeviceCon;
                ceEngine.CreateDatabase();
                ceEngine.Dispose();

                SqlCeRemoteDataAccess rda = null;

                rda = new SqlCeRemoteDataAccess(rdaURL, localDeviceCon);
                rda.InternetUrl = rdaURL;
                rda.LocalConnectionString = localDeviceCon;

                rda.Pull("Customers", "Select * from Customers", rdaOledbCon, RdaTrackOption.TrackingOn);
                rda.Pull("CustTest", "Select * from CustTest", rdaOledbCon, RdaTrackOption.TrackingOn);

                rda.Dispose();

                MessageBox.Show("Done!");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void mnuAddRow_Click(object sender, EventArgs e)
        {
            try
            {
                SqlCeConnection connection = new SqlCeConnection(localDeviceCon);
                connection.Open();

                string guid = Guid.NewGuid().ToString();
                string sql = "Insert into Customers(FirstName, LastName, State, ID) values('Sreejith', 'V.R.', 'Kerala', '" + guid + "')";

                SqlCeCommand command = new SqlCeCommand(sql, connection);
                command.ExecuteNonQuery();

                command.Dispose();
                connection.Dispose();

                MessageBox.Show("Done!");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void mnuRDAPush_Click(object sender, EventArgs e)
        {
            try
            {
                SqlCeRemoteDataAccess rda = null;

                rda = new SqlCeRemoteDataAccess(rdaURL, localDeviceCon);
                rda.Push("Customers", rdaOledbCon, RdaBatchOption.BatchingOn);

                rda.Dispose();

                MessageBox.Show("Done!");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void mnuPopulateGrid_Click(object sender, EventArgs e)
        {
            SqlCeConnection connection = new SqlCeConnection(localDeviceCon);
            connection.Open();

            DataSet ds = new DataSet();
            SqlCeDataAdapter adpt = new SqlCeDataAdapter("Select * from Customers", connection);

            adpt.Fill(ds,"Customers");

            connection.Dispose();

            grdRDA.DataSource = ds.Tables["Customers"];
        }
    }
}
Reply With Quote
Sponsored Links
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows Media Player ERROR nwfoto Software 0 12-12-2007 04:13 PM
WMP Mobile Error Heman.Molina Software 1 03-13-2007 02:41 AM
windows error on easysync!!! shyboi888 Software 2 10-18-2006 12:29 PM
MS Mobile Application Development Toolkit 2.0 Available Brad Isaac Pocket PC Addict Archive 1 01-13-2005 11:18 AM
Integrate ActivePrint into your Mobile Application cteel2004 Pocket PC Addict Archive 0 10-13-2004 08:05 PM


All times are GMT -5. The time now is 10:56 AM.




Content Relevant URLs by vBSEO 3.0.0 RC3
All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2006 by Pocket PC Addict