C# .NET - convert sdf to mdb

Asked By Bhanuprakash T.R on 29-Jun-11 08:07 AM
hello sir,

     what ever enter the values stored in windows ce mobile database .. i want get all details in our pc.... please send any links and source code... very urgent


   i want convert sdf to mdf please send source code



       
Reena Jain replied to Bhanuprakash T.R on 29-Jun-11 08:23 AM
hi,

you can use a third party commercial application http://www.dbnetcopy.com/ that will copy data between SQL Server Compact and most other major database vendors. Limited to 1000 records per table for the non-licensed version.

Hope this will help you
Ravi S replied to Bhanuprakash T.R on 29-Jun-11 08:50 AM
HI

here is the link where you can convert sdf to mdb

kindly refer the link
http://www.2000shareware.com/downloads/convert/sdf/to/mdb/
Kirtan Patel replied to Bhanuprakash T.R on 29-Jun-11 11:37 PM
Step 1
Make a new Access database. Go to the tables tab and right click in the large whitespace area. Select Import. You'll need an odbc connection to your SQL database. You can import all of your tables at once. 

Step 2
For your views, I would try copying and pasting the views SQL into queries. I don't think it will work to import them as queries, and there will probably be some differences in the SQL between Access and MS SQL. 

Thanks
Jitendra Faye replied to Bhanuprakash T.R on 30-Jun-11 02:16 AM
I have taken two con. object for connecting with  sdf database and mdf.

and also i have taken dataset ds1 , which will hold value from sdf database.

here I have  read data from ds1 and then insert into MDF database

try this code-


string stConnection1 = "constring1"; //for sdf
string stConnection2 = "constring2"; //for mdf
SqlConnection cn1 = new SqlConnection(stConnection1 ); SqlCommand cmd1= new SqlCommand("select * from employees",cn1); SqlCeDataAdapter da1= new SqlCeDataAdapter (cmd1); SqlCommandBuilder cb = new SqlCommandBuilder(da1);

   SqlConnection cn2 = new SqlConnection(stConnection2 );
   SqlCommand cmd2= new SqlCommand();
cmd2.Connection=cn2;








DataSet ds1= new DataSet();

da1.Fill(ds1,"Employees");


  




int limit = ds1.Tables["Employees"].Rows.Count;


for
(int i = 0; i < limit; i++)

{

//NOW INSERT DATA INTO MDF DATABASE

string strInsert= "Insert into tablename(col1,col2) values('" + ds1.Tables["Employees"].Rows[i][0].ToString() + "','" + ds2.Tables["Employees"].Rows[i][1].ToString() + "' )"

cmd2.Commandtext=strInsert;
cmd2.ExecuteNonQuery();

}



try this code and let me know.

Jitendra Faye replied to Bhanuprakash T.R on 30-Jun-11 02:23 AM
I have taken two con. object for connecting with  sdf database and mdf.

and also i have taken dataset ds1 , which will hold value from sdf database.

here I have  read data from ds1 and then insert into MDF database

try this code-


string stConnection1 = "constring1"; //for sdf
string stConnection2 = "constring2"; //for mdf
SqlConnection cn1 = new SqlConnection(stConnection1 ); SqlCommand cmd1= new SqlCommand("select * from employees",cn1); SqlCeDataAdapter da1= new SqlCeDataAdapter (cmd1); SqlCommandBuilder cb = new SqlCommandBuilder(da1);

   SqlConnection cn2 = new SqlConnection(stConnection2 );
   SqlCommand cmd2= new SqlCommand();
cmd2.Connection=cn2;








DataSet ds1= new DataSet();

da1.Fill(ds1,"Employees");


  




int limit = ds1.Tables["Employees"].Rows.Count;


for
(int i = 0; i < limit; i++)

{

//NOW INSERT DATA INTO MDF DATABASE

string strInsert= "Insert into tablename(col1,col2) values('" + ds1.Tables["Employees"].Rows[i][0].ToString() + "','" + ds2.Tables["Employees"].Rows[i][1].ToString() + "' )"

cmd2.Commandtext=strInsert;
cmd2.ExecuteNonQuery();

}



try this code and let me know.
Kirtan Patel replied to Bhanuprakash T.R on 30-Jun-11 11:58 AM
This 3rd party tool might be able to help you

: http://www.primeworks-mobile.com/Products/DataPortWizard.html


Thanks