Unix Technical Forum

BUG #2044: OLEDB Driver error

This is a discussion on BUG #2044: OLEDB Driver error within the pgsql Bugs forums, part of the PostgreSQL category; --> The following bug has been logged online: Bug reference: 2044 Logged by: balamuralikn Email address: balamuralikn@rediffmail.com PostgreSQL version: 8.0.4 ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Bugs

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 10:27 AM
balamuralikn
 
Posts: n/a
Default BUG #2044: OLEDB Driver error


The following bug has been logged online:

Bug reference: 2044
Logged by: balamuralikn
Email address: balamuralikn@rediffmail.com
PostgreSQL version: 8.0.4
Operating system: Win 2000
Description: OLEDB Driver error
Details:

iam facing the following error on execution of the given c# code using
pgoledb driver 1.0.0.19

Error :
---------
F:\CSharpTest\OLEDBTest>customermanager
Befor ExecuteReader
OleDb Exception System.Data.OleDb.OleDbException: No error information
availab
le: 0x80040155.
at System.Data.OleDb.OleDbDataReader.ProcessResults(I nt32 hr)
at System.Data.OleDb.OleDbDataReader.NextResult()
at System.Data.OleDb.OleDbCommand.ExecuteReaderIntern al(CommandBehavior
beh
avior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(Comma ndBehavior
behavior)
at Customer.FindByName(String strName)

Source Code File - CustomerManager.cs)
------------------------------------------
using System;
using System.Data.OleDb;
public class Customer{
string strName;
string strAddr;
String strCon = "Provider=PostgreSQL OLE DB Provider;Password=relax;User
ID=postgres; Data Source=anu;Location=test;Extended Properties=";
// String strCon = "Provider=SQLOLEDB;User
ID=sa;pwd=;Server=anu;Database=test";

OleDbConnection con ;

public Customer(){
con = new OleDbConnection(strCon);
con.Open();
}
public String Name{
get {
return strName;
}
set {
strName = value;
}
}
public String Address{
get {
return strAddr;
}
set {
strAddr = value;
}
}
public void Add() {
String strInsert = "Insert into customers (Name, Address) values (";
strInsert += "'" +Name +"', ";
strInsert += "'" +Address +"')";
OleDbCommand cmd = new OleDbCommand(strInsert);
cmd.Connection = con;
cmd.ExecuteNonQuery();
}

public Customer FindByName(String strName) {
try{
String strSql = "Select * from Customers where Name = '"+ strName +
"'";
OleDbCommand cmd = new OleDbCommand(strSql, con);
Console.WriteLine("Befor ExecuteReader");
OleDbDataReader objReader =
cmd.ExecuteReader(System.Data.CommandBehavior.Clos eConnection);
Console.WriteLine("Befor 'Read'");
if (objReader.Read()){
Console.WriteLine("After 'Read'");
Name = objReader.GetString(0);
Address = objReader.GetString(1);
Console.WriteLine("After 'Fetch'");
}
else{
throw new Exception("Customer not found");
}
}catch(OleDbException e){
Console.WriteLine("OleDb Exception " +e);
throw e;
}catch(Exception e){
Console.WriteLine("Application Exception " +e);
throw e;
}
return this;
}
};

public class CustomerManager{
public static void Main(String [] a){
/* //Test for adding new customer - perfectly working with postgre
if (a.Length > 0){
try{
Customer cust = new Customer();
cust.Name = a[0];
cust.Address = a[1];
cust.Add();
Console.WriteLine("Sucess");
}catch(Exception e){
Console.WriteLine("Error : " + e);
}
}
else{
Console.WriteLine("Invalid arguments");
} */
// Test for finding customer - not working with postgre
try{
Customer cust = new Customer() ;
cust = cust.FindByName("Murali");
Console.WriteLine("Name : " + cust.Name);
Console.WriteLine("Address : " + cust.Address);
}catch(OleDbException ex){
// Console.WriteLine("Data Error :"+ ex.StackTrace);
}catch(Exception ex){
// Console.WriteLine("Application Error :"+ ex.StackTrace);
}
}
};

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:10 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com