My database script is as follows.
CREATE TABLE books
(
book_name national character varying(50) not null primary key
);
When I try to execute code in C #
private void button1_Click(object sender, EventArgs e)
{
string sql = "INSERT INTO books(book_name) SELECT NULL;";
string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString;
using (NpgsqlConnection connection = new NpgsqlConnection(connectionString))
{
connection.Open();
using (NpgsqlCommand npgsqlCommand = new NpgsqlCommand(sql, connection))
{
npgsqlCommand.ExecuteNonQuery();
}
}
}
This gives me this error:
An unhandled exception of type "System.NotSupportedException" occurred in Npgsql.dll
Additional Information: Backend sent an unrecognized response type: _
I know that I pass a NULL value in a NOT NULL column . I want to get the exact error message. What the hell does the above error mean?
source
share