[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.odbcnet

Re: Connecting to Faircom Db using ODBC.net

Paul Jefferies

7/24/2002 1:11:00 PM

Okay, moved the code to a console app. All appears to run okay, but then
if I add a method to instantiate a Font class (like the line that threw
the Exception in the winform app) I get the same problem.
I definately suspect either the Microsoft.Data.Odbc.dll or the c-tree
Odbc driver, I just do not know how find out exactly where the problem
lies (and if there is a short-term workaround)
I have flagged this to Faircom already, still waiting for a response.

Here's the Console app code for ref:

using System;
using System.Data;
using System.Drawing;
using Microsoft.Data.Odbc;

namespace ConsoleApplication1{
class Class1{
static void Main(string[] args){
Console.WriteLine("Starting");
RunDb();
RunOtherBit();
Console.WriteLine("finished");
Console.ReadLine();
}

static void RunDb(){
OdbcConnection conn = null;

try {
conn = new OdbcConnection("DSNircom 32bit Driver");
conn.Open();

string SqlStr = "SELECT * FROM CUSTOMERS WHERE cm_custnumb = 'C102'";
OdbcDataAdapter da = new OdbcDataAdapter(SqlStr, conn);
DataSet ds = new DataSet();
da.Fill(ds);
Console.WriteLine("select done");

} catch (OdbcException e) {
string err = "ODBC err: " + e.Message;
Console.WriteLine(err); } catch (Exception e) {
string err = "Exception : "+ e.Message;
Console.WriteLine(err);
} finally {
if (conn != null) {
conn.Close(); conn = null; }
}
}

static void RunOtherBit(){
try{
Font fnt = new Font("Times New Roman", 8.25F);
Console.WriteLine("font created");
} catch (Exception e) {
Console.WriteLine("FONT err : " + e.Message); }
}
}
}

*** Sent via Developersdex http://www.develop... ***
Don't just participate in USENET...get rewarded for it!