How to add a record in the database with the indication of the desired scheme? The problem with the request. If you do not specify the name of the scheme, then writes to public, if I specify then I get an error.

public void insertquery(string sName) { command.CommandText = $"INSERT INTO rpsql.s_test(script_name) values ('{sName}')"; connection.Open(); command.ExecuteNonQuery(); connection.Close(); } 

enter image description here

  • You have schema_name is the name of the schema, what's the question? - RusArt
  • @Ruslan Artamonov, corrected. - YoFi
  • Give another text of the error, please - RusArt
  • added screenshots. - YoFi

1 answer 1

If you write the name of the schema without quotes, it is substituted with lower case letters. You have a schema name in the database written in upper case letters, then write $"INSERT INTO \"RPSQL\".s_test(script_name)"