I am using postgreSQL database. I need to add "Numeric" and "Boolean" parametres with SQL query. What do I have to write where I wrote in the code "XXX" Here is the source code:
NpgsqlCommand TupCmd = new NpgsqlCommand("UPDATE istabu_tipi SET cena=@cena,istabas_tipa_apraksts=@apr,smeketaju=@smek WHERE id_istabas_tips=@id", con);
TupCmd.Parameters.Add(new NpgsqlParameter("@cena", NpgsqlTypes.NpgsqlDbType.Numeric, XXX, "cena"));
TupCmd.Parameters.Add(new NpgsqlParameter("@apr", NpgsqlTypes.NpgsqlDbType.Varchar, 255, "istabas_tipa_a开发者_高级运维praksts"));
TupCmd.Parameters.Add(new NpgsqlParameter("@smek", NpgsqlTypes.NpgsqlDbType.Boolean, XXX, "smeketaju"));
TupCmd.Parameters.Add(new NpgsqlParameter("@id", NpgsqlTypes.NpgsqlDbType.Integer, sizeof(int), "id_istabas_tips"));
For boolean you can put the size of 1. For numeric you can use a value of 4.
Npgsql doesn't make use of this size for numeric types or boolean. It is mainly used for char and varchar datatypes.
I hope it helps.
精彩评论