There is the following code:
private void FormViewing_Load(object sender, EventArgs e)
{
OpenConnection();
FillFields();
}
private void OpenConnection()
{
connectionString = string.Format("DataSource=\"{0}\"; Password=\"{1}\"", dbPath, Constants.DB_PASSWORD);
connection = new SqlCeConnection(connectionString);
connection.Open();
}
private void FillFields()
{
string sql = string.Format("SELECT COUNT(*) FROM {0})",
Constants.TABLE_NAME);
SqlCeCommand selectCommand = new SqlCeCommand(sql, connection);
try
{
Console.WriteLine(selectCommand.ExecuteScalar());
}
catch (Exception exeption)
{
this.Text = exeption.Message;
}
}
I need to get count of entries, but I get the exception:
There was an error parsing the query
I don’t understand what a mistake I made. Please, describe a problem.
Could it be the right parenthesis “)” in: