Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1552
  • Last Modified:

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

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);
}
0
Hojoformo
Asked:
Hojoformo
  • 2
2 Solutions
 
HojoformoAuthor Commented:
Could this have something to do with a DASH in the column field values? My part numbers are formatted as follows:
  0011-91421
  0012-91504
  0012-91526
0
 
havj123Commented:
Try this

foundRows = dsFile.Tables["Packages"].Select("PartNumber =' " + partnumber" ' ");
0
 
Daniel JungesCommented:
little correction
foundRows = dsFile.Tables["Packages"].Select("PartNumber =' " + partnumber + " ' ");
0
 
havj123Commented:
Oh. .........thanks. Junges
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now