c# mysql try to select but error

Posted on 2011-10-23
Last Modified: 2012-05-12
when i run this code with phpmyadmin it give 8801 I try it with c# it have and error how can i fix it
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data.MySqlClient;

namespace ConsoleApplication2
    class Program
        static void Main(string[] args)

            MySqlConnection conDatabase = new MySqlConnection("Data Source=localhost;" +
                                       "Persist Security Info=yes;" +
                                       "UserId=tee; PWD=t5794; database=ph3;" +

            using (MySqlCommand cmd = new MySqlCommand("SELECT COUNT( * ) FROM  `member`  WHERE  `tambol` LIKE  '¿¿¿¿¿¿¿' ", conDatabase))

                        int count = (int)cmd.ExecuteScalar();


                    catch (MySqlException ex)

Open in new window

Question by:teera
    LVL 9

    Expert Comment

    use long instead of int, executescalar returns int64

    Author Comment

    hi raysonlee

    it work but
    why int is not from -2,000,000 to 2,000,000

    it only  8801
    LVL 9

    Accepted Solution

    int is int32, which is from -2,147,483,648 to +2,147,483,647
    long is int64, which is from -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807
    I suppose ExecuteScalar use int64 so that it can handle query to database with more than 2G records

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
    Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now