Skip to content

Commit

Permalink
Fixed manual to show examples using NpgsqlDbType instead of DbType. U…
Browse files Browse the repository at this point in the history
…sing DbType is only provided for backwards compatibility. NpgsqlDbType is the prefered way to specify paramter types.
  • Loading branch information
fxjr committed Dec 20, 2009
1 parent afe3540 commit 4586230
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions docs/UserManual.html
Expand Up @@ -503,7 +503,7 @@ <h3> Using parameters in a query </h3>
{

// Now add the parameter to the parameter collection of the command specifying its type.
command.Parameters.Add(new NpgsqlParameter("value1", DbType.Int32));
command.Parameters.Add(new NpgsqlParameter("value1", NpgsqlDbType.Integer));

// Now, add a value to it and later execute the command as usual.
command.Parameters[0].Value = 4;
Expand Down Expand Up @@ -553,7 +553,7 @@ <h3> Using prepared statements</h3>
using(NpgsqlCommand command = new NpgsqlCommand("select * from tablea where column1 = :column1", conn))
{
// Now add the parameter to the parameter collection of the command specifying its type.
command.Parameters.Add(new NpgsqlParameter("column1", DbType.Int32);
command.Parameters.Add(new NpgsqlParameter("column1", NpgsqlDbType.Integer);

// Now, prepare the statement.
command.Prepare();
Expand Down Expand Up @@ -653,7 +653,7 @@ <h3> Function calling</h3>

command.Parameters.Add(new NpgsqlParameter());

command.Parameters[0].DbType = DbType.Int32;
command.Parameters[0].NpgsqlDbType = NpgsqlDbType.Integer;
command.Parameters[0].Value = 4;

Object result = command.ExecuteScalar();
Expand Down Expand Up @@ -861,11 +861,11 @@ <h3> Working with .NET Datasets </h3>
da.InsertCommand = new NpgsqlCommand("insert into tableb(field_int2, field_timestamp, field_numeric) " +
" values (:a, :b, :c)", conn);

da.InsertCommand.Parameters.Add(new NpgsqlParameter("a", DbType.Int16));
da.InsertCommand.Parameters.Add(new NpgsqlParameter("a", NpgsqlDbType.Smallint));

da.InsertCommand.Parameters.Add(new NpgsqlParameter("b", DbType.DateTime));
da.InsertCommand.Parameters.Add(new NpgsqlParameter("b", NpgsqlDbType.Timestamp));

da.InsertCommand.Parameters.Add(new NpgsqlParameter("c", DbType.Decimal));
da.InsertCommand.Parameters.Add(new NpgsqlParameter("c", NpgsqlDbType.Numeric));

da.InsertCommand.Parameters[0].Direction = ParameterDirection.Input;
da.InsertCommand.Parameters[1].Direction = ParameterDirection.Input;
Expand Down Expand Up @@ -1055,7 +1055,7 @@ <h3>Working with binary data and bytea datatype</h3>

NpgsqlCommand command = new NpgsqlCommand("insert into tableBytea(field_bytea) values(:bytesData)", conn);

NpgsqlParameter param = new NpgsqlParameter(":bytesData", DbType.Binary);
NpgsqlParameter param = new NpgsqlParameter(":bytesData", NpgsqlDbType.Bytea);

param.Value = bytes;

Expand Down

0 comments on commit 4586230

Please sign in to comment.