Tuesday, November 26, 2013

Problem with count(*)

Hi,

With these codes against Access DB,


cmd3 = new OleDbCommand("SELECT count(*) cnt FROM ite_tab2 where ite_id=@par_id and int_id<12", conn);

int ite_id;
bool b = int.TryParse(lb_objid.Text, out ite_id);

cmd3.Parameters.Add("@par_id", OleDbType.Integer).Value = ite_id;
int cnt = Convert.ToInt32(cmd3.ExecuteScalar());





I get this exception. why?

Syntax error (missing operator) in query expression 'count(*) cnt'.Microsoft Access Database Engine



Many Thanks & Best Regards, Hua Min


No comments:

Post a Comment