soonhuat81

soonhuat81

  • NA
  • 31
  • 0

Filtering Data (By Parameter) ERRORS

Jun 29 2004 5:10 AM
When i try the following code, the system is works fine ... It will filtered all the ProductKey which is equal to 3 public void OnFormLoad(string ProductKey) { myDataSet.Tables[0].DefaultView.RowFilter = "ProductKey= 3"; } Anyway, when i passed a parameter to the procedure (to filter by the parameter) as shown by following code, the system generates an error public void OnFormLoad(string ProductKey) { myDataSet.Tables[0].DefaultView.RowFilter = "ProductKey= '" + ProductKey+ "'"; } Here r the errors message : An unhandled exception of type 'System.Data.EvaluateException' occurred in system.data.dll Additional information: Cannot perform '=' operation on System.Int32 and System.String. What's wrong with the code ? I've tried so many times on this one but still cant figure it out..Anyone help pls .. Thanks

Answers (1)