The select query is not working in the below case.
string sssss = "InspectorADEL2018 -11-13";
con.Open();
String value1 = "select * from finalreport where rmid='"+sssss+"'; ";
SQLiteCommand cmd13 = new SQLiteCommand(value1, con);
dr13 = cmd13.ExecuteReader();
while (dr13.Read())
{
Console.WriteLine("The command executed");
}
con.Close();
But when we tried the below one the query works and get the output.
con.Open();
String value1 = "select * from finalreport where rmid='InspectorADEL2018 -11-13'; ";
SQLiteCommand cmd13 = new SQLiteCommand(value1, con);
dr13 = cmd13.ExecuteReader();
while (dr13.Read())
{
Console.WriteLine("The command executed");
}
con.Close();
How can I solve the problem when we assign the value to a string variable?