Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / April 2007

Tip: Looking for answers? Try searching our database.

Working with database in C# Pocket PC

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sheikko - 06 Apr 2007 12:00 GMT
Working with database in C# Pocket PC

Hi all,
I want to develop an application that work with DB on pocket PC.
I have added the DB to the project from Menu->Data->Add New Data
Source.
I want to insert some Rows in a table of this Db.
I know that I can create a connection and insert values with sql
statements like that:

       public void SaveSettings(TSaveSettings Values)
       {

           DBConnection = new SqlCeConnection();
           DBConnection.ConnectionString = @"Data Source = ..\My
Documents\Db.sdf";

           //Create a SqlCeCommand on your connection
           SqlCeCommand InsertCommand = DBConnection.CreateCommand();

           //Set the CommandText for the command
           //The ?'s represent parameters that will be set later
           InsertCommand.CommandText = "Insert Into Settings(ComPort)
Values (?)";

           //Add parameters and assign them the values from the
TextBoxes on the form
           InsertCommand.Parameters.Add(new SqlCeParameter("ComPort",
SqlDbType.NText));

           InsertCommand.Parameters["ComPort"].Value =
Values.ComPort;

           //Open the connection, execute the query
           DBConnection.Open();
           InsertCommand.ExecuteNonQuery();

           //Close the connection
           if (DBConnection.State == ConnectionState.Open)
               DBConnection.Close();
       }

in this way it work, but why I have added the Db to the project? I
want from my application to make operation on my DB without creating
connection, open it and close it by code, but I want to use smoe
things like dataset, adding rows by rows.add().. and so on.

Can you help me with some examples or tutorials on line?
thank you very much
LaFlour - 06 Apr 2007 14:36 GMT
> Working with database in C# Pocket PC
> in this way it work, but why I have added the Db to the project? I

What do you meant? Can you make it clear?
Ginny Caughey [MVP] - 08 Apr 2007 12:43 GMT
I'm not sure exactly what you're asking, but tutorials are available here:
http://www.microsoft.com/sql/editions/compact/default.mspx

Signature

Ginny

> Working with database in C# Pocket PC
>
[quoted text clipped - 45 lines]
> Can you help me with some examples or tutorials on line?
> thank you very much

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.