views:

465

answers:

2
+6  A: 

Try surrounding 'user' with square brackets, '[user]' (and possibly date).

Mitch Wheat
A: 

In SqlCe u cannot use directly the parameters I mean the sentence:

Blockquote

" string sql = "INSERT INTO posts(user,msg,avatar,date) VALUES(@username,@messige,@userpic,@thedate)"; is wrong it should be string sql = "INSERT INTO posts(user,msg,avatar,date) VALUES(?,?,?,?)"; and then followed by: using (SqlCeCommand cmd = new SqlCeCommand(sql, connection)) { cmd.Parameters.Add("@username",C); cmd.Parameters.Add("@messige", msgText.ToString()); cmd.Parameters.Add("@userpic", avatar.ToString()); cmd.Parameters.Add("@thedate", dt); connection.Open(); cmd.ExecuteNonQuery(); adapter.Update(data); connection.Close(); } "

In SqlCe the parameters are passed as "?"

Hope it helps you

jankhana