Hello, this is a weird one, when I run the following code all rows are returned from the db. Imagaine what would happen if this was an update or delete.
Dim cmd As New NpgsqlCommand
cmd.Connection = conn
cmd.CommandText = "select * FROM ac_profiles WHERE profileid = @profileId"
cmd.Parameters.Add("@profile", 58)
Dim...
Running the following code against a large PostgreSQL table, the NpgsqlDataReader object blocks until all data is fetched.
NpgsqlCommand cmd = new NpgsqlCommand(strQuery, _conn);
NpgsqlDataReader reader = cmd.ExecuteReader(); // <-- takes 30 seconds
How can I get it to behave such that it doesn't prefetch all the data? I want to step ...
I'm working with a single NpgsqlConnection from 2 threads. Connection is protected via lock. All SQL commands are in fact calls to 3 different stored procedures, one procedure per call.
The program runs whole day, 24 hours. At some point (not very often - like, several times a day) when another call is issued to one of these stored proc...
The Problem:
NpgsqlCommand.Text: INSERT INTO mytable (id, name) VALUES (:id, :name)
Parameter 1: name=id, value=42
Parameter 2: name=name, value="whatever"
command.ExecuteScalar() does not fail, but there is no new row. No duplicate id either.
The Code:
using (var command = connection.CreateCommand()) {
command.Transaction = t...
Well, what i've already done - is i'm able to connect to access mdb table via Microsoft.Jet.OLEDB provider, then i can get a data from table, using select query, OleDbDataAdapter and a DataSet.
Now, i'm able to connect to Postgresql via Npgsql, but what escapes me - is how am i able to get the data from access table and put it into post...
why connect to postgres over internet or VPN slower than sql server ?
I have test
DateTime now0 = System.DateTime.Now;
string sqlconnectsrting = "server=xxx.xxx.xxx.xxx;database=pubs;uid=sa;pwd=";
for (int i = 0; i < 1000; i++)
{
SqlConnection connect = new SqlConnection(sqlconnectsrting);
connect.Open(...
I have a method that gets the DateTime from the DB with the following code:
NpgsqlCommand cmd = ActiveConnection.CreateCommand();
cmd.CommandText = "SELECT NOW()";
object obj = cmd.ExecuteScalar();
return (DateTime)obj;
Sometimes an InvalidCastException is thrown when converting the result to DateTime. Sometimes the result (obj) is nu...
I have a simple function that just inserts the parameter values provided to it into columns in a table.
When I run the function via the ExecuteNonQuery() method on the command object I always get -1, even if the insert took place.
If i run the same query as a Text command it gives be the correct result of 1.
I'm new to postgresql/npgs...
Why is it that the NPGSQL .NET Data Provider is slow when compared with the ODBC Provider? I have not tried NPGSQL 2.0 but I did worked with NPGSQL 1.0. It was very slow.
What are your experiences with NPGSQL 2.0?
...