Cannot perform '=' operation on System.String and System.Int32.

Posted on 2009-02-08
Last Modified: 2012-05-06
Why am I getting this message?  The column is a string and so is the search condition.

Cannot perform '=' operation on System.String and System.Int32.

public void BuildPackages(string partnumber)
     dsFile.Tables["Packages"].Columns["PartNumber"].DataType = typeof(string);
     DataRow[] foundRows;
     foundRows = dsFile.Tables["Packages"].Select("PartNumber =" + partnumber);
Question by:Hojoformo

    Author Comment

    Could this have something to do with a DASH in the column field values? My part numbers are formatted as follows:
    LVL 6

    Accepted Solution

    Try this

    foundRows = dsFile.Tables["Packages"].Select("PartNumber =' " + partnumber" ' ");
    LVL 14

    Assisted Solution

    by:Daniel Junges
    little correction
    foundRows = dsFile.Tables["Packages"].Select("PartNumber =' " + partnumber + " ' ");
    LVL 6

    Expert Comment

    Oh. .........thanks. Junges

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (…
    More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    754 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

    20 Experts available now in Live!

    Get 1:1 Help Now