Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6005619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:25:22+00:00 2026-05-23T01:25:22+00:00

I have inserted a lot of information into a SQlite database from my program.

  • 0

I have inserted a lot of information into a SQlite database from my program. Now, my small task is to look up the database and find some statistics from it.

Ex: I have a database with three fields – Timestamp, Message and Key
Now, I want to check the database in the Message column and count the number of times a certain keyword(say “ERROR”) occurs in the database.

What is the simplest way to do this?
SELECT Message from Database and how do i add the filter???

I use Regex to filter out some stuff before Insert. Should i do something similar here?

Thanks

Edit:

I used the solution mentioned below SELECT count(*) but am still unaware of how to get the value out to use it in another function. I have shown the code i used below. I am new to SQL and it possibly is wrong. Please help!

public void selectFromDatabase()
    {
        String cntnStr_query = "data source=C:\\TMU_Files\\test31.s3db";
        SQLiteConnection connection_query = new SQLiteConnection(cntnStr_query);
        connection_query.Open();
        SQLiteCommand cmd_query = connection_query.CreateCommand();
        cmd_query.CommandText = "SELECT count(*) from LogDatabase where LogMessage like '%ERR%'";
        SQLiteDataAdapter da_query = new SQLiteDataAdapter(cmd_query);
        DataSet ds_query = new DataSet();
        //MessageBox.Show(cmd_query.ExecuteNonQuery().ToString());
        //MessageBox.Show(count.ToString());
        try
        {
            da_query.Fill(ds_query);
            DataTable dt_query = ds_query.Tables[0];
        }
        catch (Exception e)
        {
            MessageBox.Show(e.ToString());
        }
        finally
        {
            cmd_query.Dispose();
            connection_query.Close();
        }
        //cmd_query.Dispose();
        //connection_query.Close();

    }
}

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T01:25:23+00:00Added an answer on May 23, 2026 at 1:25 am
    select count(*) from database where message like '%error%'
    

    As to how it should look like in code, try something like this:

    using(var sda=new SQLiteDataAdapter(
      "SELECT count(*) from LogDatabase where LogMessage like '%ERR%'",
      "data source=C:\\TMU_Files\\test31.s3db")
    {
      var dt=new DataTable();
      sda.Fill(dt);
      return dt;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a basic HTML form that gets inserted into a server side div
I'm trying to make an AJAXy submission and have the resulting partial be inserted
I have to maintain an application that has a lot of columns that are
I have a certain page and depending on an administrator role a lot of
I have a query that is taking a lot longer then usual, and I
I have a sql file which has a lot of insert statements (over 3000+).
I am having a lot of trouble trying to upgrade my existing library from
I have a script that appends some rows to a table. One of the
i have a input tag which is non editable, but some times i need
(resolved: see bottom) I have the following code snippet: Protected Sub SqlDataSource1_Inserted(ByVal sender As

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.