Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi Every one,

I using windows mobile 7 MSVS2010 Express. How do I connect to Database in this can any one find me an answer for this
Posted
Comments
Rajesh Anuhya 30-Nov-10 5:25am    
can u elobarate your question .., what is the database in the windows mobile 7., or you want to dump a new database in it.

I think you mean "Windows Phone 7." Windows Mobile 7 is the name of a Microsoft project that was cancelled and never given light of day just before the Windows Phone 7 project started.

The initial version of Windows Phone 7 has no managed support for database access. The only way it can interact with the outside world is through HTTP based communication. You will need to host a web service that your WP7 application can use to communicate with the server. Note that SQL Server does have built in support for exposing functionality as web services.
 
Share this answer
 
Comments
Nish Nishant 19-Jan-11 16:35pm    
Voted 5, and proposed as answer.
Look at SqlCE.
Reference: System.Data.SqlServerCE
Namespace: System.Data.SqlServerCe
Look at SqlCeConnection and SqlCeCommand methods.
C#
con = new SqlCeConnection(ConnectionString);
con.Open();

C#
/// <summary>
/// Read rows from a specified database table
/// </summary>
/// <param name="table">Name of table to read from</param>
/// <returns>DataTable containing the rows read.</returns>
public static DataTable Read(string table)
    {
    DataTable dt = new DataTable();
    using (SqlCeCommand cmd = new SqlCeCommand("SELECT * FROM " + table, con))
        {
        SqlCeDataAdapter da = new SqlCeDataAdapter(cmd);
        da.Fill(dt);
        }
    return dt;
    }
 
Share this answer
 
Comments
vaikuntapu 18-Nov-10 1:23am    
Hi,

In Window Mobile 7 there is no "SqlCeConnection".
In Window Mobile 7 there is no "SqlCeConnection"
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900