Simple.Data, how to select when column name contains ?, -, / and other special character?

StackOverflow https://stackoverflow.com/questions/21093878

  •  27-09-2022
  •  | 
  •  

Question

I am using Simple.Data to query the DB. but this particular DB is imported from Access DB.

some of the filed names has space, -, / in it.

Policy Number
FTZ?
Prod/Co
Covg - Years

is it possible to use Simple.Data? how do you name your object so Simple.Data will know which field to query.

public class item {
  public string "Policy Number" {get; set;}
  public string "FTZ?" {get; set;}
  ...
}
Was it helpful?

Solution

You can just leave out non-alphanumeric characters in your identifiers, and Simple.Data will still find the matching columns.

e.g.

Item item = db.Items.FindByPolicyNumber(pnum);

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top