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

  • SEARCH
  • Home
  • 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 6538601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:45:17+00:00 2026-05-25T10:45:17+00:00

How to remove items local database after added add(01:23:45:67:89:ac, yes); //add new item static

  • 0

How to remove items local database after added

 add("01:23:45:67:89:ac", "yes"); //add new item


    static void add(string id, string input)
    {
        using (SqlCeConnection connection = new SqlCeConnection("datasource=base.sdf"))
        {
            connection.Open();
            try
            {
                using (SqlCeCommand command = new SqlCeCommand("INSERT INTO userinput VALUES(@macadres, @userinput)", connection))
                {
                    command.Parameters.Add(new SqlCeParameter("macadres", id));
                    command.Parameters.Add(new SqlCeParameter("userinput", input));
                    command.ExecuteNonQuery();
                }
            }
            catch
            {
                Console.WriteLine("Not OK.");
            }
            connection.Close();
        }
    }

Need to remove added 01:23:45:67:89:ac

DeleteRecord(“01:23:45:67:89:ac”);

    static void DeleteRecord(string id)
    {
        using (SqlCeConnection connection = new SqlCeConnection("datasource=base.sdf"))
        {
            connection.Open();
            try
            {
                using (SqlCeCommand command = new SqlCeCommand("DELETE FROM userinput WHERE macadres ='" + id + "'"))
                {
                    command.Connection.Open();
                    command.ExecuteNonQuery();
                }
            }
            catch(Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            connection.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-25T10:45:18+00:00Added an answer on May 25, 2026 at 10:45 am
     DeleteRecord("01:23:45:67:89:ac");
    
        static void DeleteRecord(string id)
        {
            using (SqlCeConnection connection = new SqlCeConnection("datasource=base.sdf"))
            {
                connection.Open();
                try
                {
                    using (SqlCeCommand command = new SqlCeCommand("DELTE FROM userinput WHERE macadres ='"+ id +"'", connection);
                    {
                        command.ExecuteNonQuery();
                    }
                }
                catch
                {
                    Console.WriteLine("Not OK.");
                }
                finally
                {
                  connection.Close();
                }
    
            }
        }
    

    Or you can create one method for delete any record by giving connection and query as bellow

    string connectionstring = "datasource=base.sdf"; // "Data Source = MyDatabase.sdf; Password ='<pwd>'"
    string deleteQuery = "DELTE FROM userinput WHERE macadres ='"+ id +"'";     
    

    you can call as bellow

    MyExecuteNonQuery( deleteQuery , connectionstring);
    

    here ie the method implimentation

       private void MyExecuteNonQuery(string queryString,
            string connectionString)
        {
            SqlCeConnection conn = null;
            try
            {
                conn = new SqlCeConnection(connectionString);
                conn.Open();
    
                SqlCeCommand cmd = conn.CreateCommand();
                cmd.CommandText = queryString;
    
                cmd.ExecuteNonQuery();
            }
            finally
            {
                conn.Close();
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How do I remove items from, or add items to, a select box? I'm
I'm trying to create a player who can add and remove items from their
What I want to do is add and remove list items. I have got
I am using the local database in web kit browsers and to get the
I'm trying to write a console application that will run and remove/add items to
A many-to-many relationship has to methods to remove items: Delete and Remove. What is
When I am writing code in Python, I often need to remove items from
I need to remove multiple items from a Dictionary. A simple way to do
I'm trying to remove some items of a dict based on their key, here
I need to display a menu in Joomla and remove 2 items from it.

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.