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 9249551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:13:29+00:00 2026-06-18T10:13:29+00:00

I have this helper function: public bool Delete(String tableName, String where) { Boolean returnCode

  • 0

I have this helper function:

public bool Delete(String tableName, String where)
    {
        Boolean returnCode = true;
        try
        {
            this.ExecuteNonQuery(String.Format("delete from {0} where {1};", tableName, where));                
        }
        catch (Exception fail)
        {
            MessageBox.Show(fail.Message);
            returnCode = false;
        }
        return returnCode;
    }

TableName contains “[MyTable]”
and where contains “[MyTable ID]=’4ffbd580-b17d-4731-b162-ede8d698e026′” which is a unique guid representing the row ID.

The function returns true, like it was successful, and no exception, but the rows are not deleted from DB, what’s wong?

This is the ExecuteNonQuery function

 public int ExecuteNonQuery(string sql)
    {
        SQLiteConnection cnn = new SQLiteConnection(dbConnection);
        cnn.Open();
        SQLiteCommand mycommand = new SQLiteCommand(cnn);
        mycommand.CommandText = sql;
        int rowsUpdated = mycommand.ExecuteNonQuery();
        cnn.Close();
        return rowsUpdated;
    }
  • 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-06-18T10:13:30+00:00Added an answer on June 18, 2026 at 10:13 am

    Firstly, you shouldn’t just embed SQL like that. You should use parameterized SQL, to avoid SQL injection attacks.

    Next, you should look at the return value of ExecuteNonQuery. Assuming it follows the normal pattern of ExecuteNonQuery, it should return the number of rows affected. I suspect it’s returning 0, which will mean that nothing’s matching your where clause.

    (I’d also stop catching Exception – probably stop catching anything, but at least catch something specific if you must. I’d get rid of the local variable, too, and just return directly when you know what you want to return…)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Soooo, I have this function public function playerslist() { $this->load->database(); $data = $this->db->get('skaters')->result(); $this->load->helper('url');
In a controller class I have this function: public function index(){ $this->load->helper('url'); $data['title'] =
I have this static helper function: public static DependencyObject GetParentObject(DependencyObject child) { if (child
So I have this function: public static BaseList GetVersesByChapterVerseRanges(string translation, BaseList criteriaList) { BaseList
I have the following function call: public static MvcHtmlString NavLinks( this HtmlHelper helper, IList<MenuItem>
Okay, I have this in my Codeigniter controller: public function post($id) { $data['query'] =
I have this scenario: Interface ClassInterface { public function getContext(); } Class A implements
I've got this function public static AdoEntity.Inspector GetInspectorWithInclude(int id, List<string> properties) { using (var
I have this code class PagamentoController extends Zend_Controller_Action { public function init() { /*
In PHP 5.3.6 I have a class with a method like this: public function

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.