Click here to Skip to main content
15,894,405 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I am trying to insert data onto .sdf database. But the data is not showing in database file.

here is the code i am using

string cmdtext = ("Data Source=" + (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)) + "\\MaximoLocalDB.sdf;Password=<>;Persist Security Info=False;");

            SqlCeConnection con = new SqlCeConnection(cmdtext);
            SqlCeCommand cmd = new SqlCeCommand("insert into cftmob(cft,dsc,transid,transseq) values('"+textBox1.Text+"','"+textBox2.Text+"',106,1)",con);
            con.Open();
            cmd.ExecuteNonQuery();
            con.Close();



Any one know about this issue? help me.

Thanks,
Balu
Posted
Updated 14-Dec-11 22:03pm
v3

Where is INTO in Insert Command.
 
Share this answer
 
v2
Comments
Balu199 15-Dec-11 4:05am    
It's an posting mistake.Into is not the right answer.

It's Compact database error.
Suresh Suthar 15-Dec-11 4:30am    
What error its showing?
There is syntatical mistake in SQlQuery. you have not put INTO in it. here is corrected Query.

C#
insert into cftmob(cft,dsc,transid,transseq) values('"+textBox1.Text+"','"+textBox2.Text+"',106,1);
 
Share this answer
 
v2
Please notice that there is used into in query.
 
Share this answer
 
may be you have an error in the cmdstring check it out..
 
Share this answer
 
v2

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