Click here to Skip to main content
15,887,302 members
Home / Discussions / C#
   

C#

 
QuestionDatabase Question Pin
matris20109-May-10 6:03
matris20109-May-10 6:03 
AnswerRe: Database Question Pin
OriginalGriff9-May-10 6:10
mveOriginalGriff9-May-10 6:10 
Questionbinary database Pin
Jassim Rahma9-May-10 5:02
Jassim Rahma9-May-10 5:02 
AnswerRe: binary database Pin
OriginalGriff9-May-10 5:53
mveOriginalGriff9-May-10 5:53 
GeneralRe: binary database Pin
harold aptroot9-May-10 6:09
harold aptroot9-May-10 6:09 
AnswerRe: binary database Pin
Alex Manolescu9-May-10 9:11
Alex Manolescu9-May-10 9:11 
Questionhow to insert a new line in a table of a .sdf file smart device application Pin
bacem smari9-May-10 4:47
bacem smari9-May-10 4:47 
AnswerRe: how to insert a new line in a table of a .sdf file smart device application Pin
Stanciu Vlad9-May-10 9:13
Stanciu Vlad9-May-10 9:13 
I think you should execute the command afther you add the parameters to it, or else the insert will fail (as it has so far) havning nothing to insert.

Something like this:
private void menuItem4_Click(object sender, EventArgs e)        {            
  string wCS = @"Data Source =\Storage Card\ModeDifféré\BaseGmaoLocale.sdf;";            
  SqlCeConnection sqlceconn = new SqlCeConnection(wCS);           
  SqlCeCommand command2 = sqlceconn.CreateCommand();            
  command2.CommandText = "INSERT INTO compteurs2 ([com], [quantite],[datequantite] ) Values(@com,@qtte,SYSDATE)";            
  //command2.ExecuteNonQuery(); -- a little mistake

  SqlCeParameter com = new SqlCeParameter("@com", SqlDbType.NVarChar);            
  com.Value = comComboBox.SelectedItem.ToString();            
  command2.Parameters.Add(com);            
  
  SqlCeParameter qtte = new SqlCeParameter("@qtte", SqlDbType.Float);            
  qtte.Value = float.Parse(textBox1.Text);            
  command2.Parameters.Add(qtte);        

  command2.ExecuteNonQuery();
}


Oh and, I an not 100% sure, but I think that SYSDATE is not supported in SQL CE, the one that should work is GETDATE().
I have no smart signature yet...

GeneralRe: how to insert a new line in a table of a .sdf file smart device application Pin
bacem smari9-May-10 20:26
bacem smari9-May-10 20:26 
GeneralRe: how to insert a new line in a table of a .sdf file smart device application Pin
Stanciu Vlad9-May-10 20:28
Stanciu Vlad9-May-10 20:28 
GeneralRe: how to insert a new line in a table of a .sdf file smart device application Pin
bacem smari9-May-10 21:06
bacem smari9-May-10 21:06 
GeneralRe: how to insert a new line in a table of a .sdf file smart device application Pin
Stanciu Vlad9-May-10 21:25
Stanciu Vlad9-May-10 21:25 
GeneralRe: how to insert a new line in a table of a .sdf file smart device application Pin
bacem smari9-May-10 21:37
bacem smari9-May-10 21:37 
GeneralRe: how to insert a new line in a table of a .sdf file smart device application Pin
Stanciu Vlad9-May-10 21:57
Stanciu Vlad9-May-10 21:57 
GeneralRe: how to insert a new line in a table of a .sdf file smart device application Pin
bacem smari9-May-10 22:15
bacem smari9-May-10 22:15 
GeneralRe: how to insert a new line in a table of a .sdf file smart device application Pin
Stanciu Vlad9-May-10 22:23
Stanciu Vlad9-May-10 22:23 
GeneralRe: how to insert a new line in a table of a .sdf file smart device application Pin
bacem smari9-May-10 22:31
bacem smari9-May-10 22:31 
GeneralRe: how to insert a new line in a table of a .sdf file smart device application Pin
Stanciu Vlad9-May-10 22:38
Stanciu Vlad9-May-10 22:38 
QuestionMessage Removed Pin
9-May-10 4:13
Sr...Frank9-May-10 4:13 
AnswerRe: Close All Child Window on Menu Click! Pin
Not Active9-May-10 4:48
mentorNot Active9-May-10 4:48 
AnswerRe: Close All Child Window on Menu Click! Pin
Heinzzy9-May-10 5:47
Heinzzy9-May-10 5:47 
GeneralRe: Close All Child Window on Menu Click! Pin
Sr...Frank9-May-10 6:36
Sr...Frank9-May-10 6:36 
GeneralRe: Close All Child Window on Menu Click! Pin
Luc Pattyn9-May-10 6:41
sitebuilderLuc Pattyn9-May-10 6:41 
GeneralRe: Close All Child Window on Menu Click! Pin
Not Active9-May-10 9:48
mentorNot Active9-May-10 9:48 
Question"Search row" in DataGridView Pin
eyalbi0079-May-10 2:52
eyalbi0079-May-10 2:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.