I have a TextBox
in which letters are scanned and do a search in Access
, the problem I have is that when the keyboard is uppercase it scans the letters in lowercase and vice versa, and at the time of doing the search gives an error in the format of the variable and is because they are in lowercase.
How can I make it identify when they are uppercase or lowercase? this is what I have.
public string selcopert()
{
int decValue = 0;
string query="";
if (opertname.StartsWith("~") && opertname.EndsWith("~") && opertname.Length > 1)
{
string oprt = Regex.Replace(opertname, @"^~UMIH\|(.*)~$", "$1");
decValue = int.Parse(oprt, System.Globalization.NumberStyles.HexNumber);
query = "SELECT * where op = '" + decValue + "' ";
}
else
{
query = "Select * op where = '" + opertname + "' ";
}
string op="";
SqlConnection cone = new SqlConnection(cc.consql);
cone.Open();
SqlCommand coms = new SqlCommand(query, cone);
using (SqlDataReader read1 = coms.ExecuteReader())
{
if (read1.Read())
{
op = read1[0].ToString();
}
}
cone.Close();
return op;
}
Or also that the Regex.Replace
recognizes case, but I do not know how to do it.