I have this code:
"SELECT tblschemeprojectpaymentgateway.paymentgatewayid, paymentgatewayname FROM " +
"tblschemeprojectpaymentgateway INNER JOIN tblpaymentgateway ON " +
"tblschemeprojectpaymentgateway.paymentgatewayid = tblpaymentgateway.paymentgatewayid"+
"WHERE tblschemeprojectpaymentgateway.schemeprojectid=`"+
SchemeProjectID.ToString()+"`", SqlConnection1);
sqlcmd.CommandType = CommandType.Text;
SqlConnection1.Open();
Npgsql.NpgsqlDataReader dr = sqlcmd.ExecuteReader();
which queries a Postgresql database. SchemeProjectID is a Guid. This code executes fine with the pgAdmin database query tool, but throws a syntax error in the C# code soemwhere around “tblschemeprojectpaymentgateway”.
I have tried the SchemeProjectID in quotes, backtics and just as it is – with and without the .ToString().
I can not figure out what is wrong.
Classic problem when splitting strings over several lines; you’re missing the space between
tblpaymentgateway.paymentgatewayidandWHERE.