Hi,
i have a big Problem with Reconnecting my PPC after WLAN Module was shut down and then reactivated.
I used the Method Dispose() on my PgSqlConnection Object and created a new one after i detected an Connection Error when i reactivated my WLAN Module on my PPC.
So, every time when WLAN was reactivated, a new Connection Object was created and OPENED. The State Property is shown "OPEN".
Now when i try to query my Database over WLAN, i get an Error Message that (its German, i try to translate): "Unable to write into the Transfer Connection", the ErrorCode was 08006. I really dont know whats happening, i already told that i create a totally new Connection Object and use the Open() Method to open that new Connection, SUCCESFULLY.
But this Error Message still appears. I hope CoreLab can tell me what ErrorCode 08006 really means.
Just imagine: Connection is open, then WLAN is shut down, then reactive, then new Connection Object created, opened and then tried to query, after these steps, ErrorMessage 08006 appears.
So whats wrong?
Best Regards and Thank You for this Great Product
PocketPC + WLAN => ErrorCode 08006
Best solution
Hi,
It has worked, Thanks
I have this code :
while(conn.connectionstate != open)
{
conn.open();
Thread.sleep(50);
}
But the connection state doesn't updated. it always show open.
what is the best way to check it ?
I have tried to do it like this :
try
{
PgsqlDataAdapter da = new PgSqlDataAdapter("select * from x",conn);
da.fill(ds);
cond = true;
}
catch
{
cond = false;
}
while(!cond)
{
conn.open();
Thread.sleep(50);
try
{
PgsqlDataAdapter da = new PgSqlDataAdapter("select * from x",conn);
da.fill(ds);
cond = true;
}
catch
{
cond = false;
}
}
But it doesn't make sense to write such a code right
It has worked, Thanks
I have this code :
while(conn.connectionstate != open)
{
conn.open();
Thread.sleep(50);
}
But the connection state doesn't updated. it always show open.
what is the best way to check it ?
I have tried to do it like this :
try
{
PgsqlDataAdapter da = new PgSqlDataAdapter("select * from x",conn);
da.fill(ds);
cond = true;
}
catch
{
cond = false;
}
while(!cond)
{
conn.open();
Thread.sleep(50);
try
{
PgsqlDataAdapter da = new PgSqlDataAdapter("select * from x",conn);
da.fill(ds);
cond = true;
}
catch
{
cond = false;
}
}
But it doesn't make sense to write such a code right
If you will set "pooling=false" in Connection string property connection state will change on open:
PgSqlConnection conn = new PgSqlConnection(";pooling = false");
conn.Open();
in such case you do not need additional checks on connection.
If you need some code to ping the existing opened connection you can use something like this:
bool Ping(PgSqlConnection conn) {
PgSqlCommand cmd = new PgSqlCommand("select 1", conn);
try {
cmd.ExecuteNonQuery();
return true;
}
catch{
return false;
}
}
PgSqlConnection conn = new PgSqlConnection(";pooling = false");
conn.Open();
in such case you do not need additional checks on connection.
If you need some code to ping the existing opened connection you can use something like this:
bool Ping(PgSqlConnection conn) {
PgSqlCommand cmd = new PgSqlCommand("select 1", conn);
try {
cmd.ExecuteNonQuery();
return true;
}
catch{
return false;
}
}