Skip site navigation (1) Skip section navigation (2)

Re: How can I keep an OdbcDataAdapter from using fully qualified tble names?

From: Barry Bell <Barry_Bell(at)harte-hanks(dot)com>
To: Rob Richardson <interrobang(at)yahoo(dot)com>, "pgsql-odbc(at)postgresql(dot)org"<pgsql-odbc(at)postgresql(dot)org>
Subject: Re: How can I keep an OdbcDataAdapter from using fully qualified tble names?
Date: 2012-04-25 14:11:58
Message-ID: 542B943ED5D72E408BF9CBBD61ABC94D52EB6956@VA3DIAXVSC31.RED001.local (view raw or flat)
Thread:
Lists: pgsql-odbc
It maybe a dns issue, The below connection works because server "my-server"
Resolves in my land from "my-server" to "my-server.mycompany.com".

Driver={PostgreSQL ANSI};Server=my-server;Port=5432;Database=dbname;Uid=user;Pwd=password;BI=2;TextAsLongVarchar=1;UnknownSizes=2;UnknownsAsLongVarchar=1;UseServerSidePrepare=1;

Does this help?

Why not go DSN-less? (Put the connection string into an INI disturbed with the program?) 
Otherwise, you will goto every computer and Update the DSN whenever the server or db name is changed


Thanks
Barry Bell, IT Department 
Office: 954-429-3771 x267 Fax: 954-281-1464 email Barry_Bell(at)harte-hanks(dot)com


-----Original Message-----
From: pgsql-odbc-owner(at)postgresql(dot)org [mailto:pgsql-odbc-owner(at)postgresql(dot)org] On Behalf Of Rob Richardson
Sent: Wednesday, April 25, 2012 10:06 AM
To: pgsql-odbc(at)postgresql(dot)org
Subject: [ODBC] How can I keep an OdbcDataAdapter from using fully qualified tble names?

Hello!

How can I keep an OdbcDataAdapter from insisting on the fully qualified table name?


In VS 2008, I am trying to use the System.Data.Odbc namespace to work with a 
PostGres database.  I don't want to use npgsql because I want to work with DSNs 
so that I get the flexibility of changing databases without changing my 
program.  


When I use an OdbcCommandBuilder object to create the insert, update and delete 
commands for me, the table names are fully qualified.  For example, an insert 
command might begin with "insert into MyDatabase.public.MyTable...".  When I try 
to use that, I get an exception thrown that complains that cross-database 
references are not implemented (even though the connection I am using is to the 
MyDatabase database).  


So, I wrote a little function that converts a string containing 
"MyDatabase.public.MyTable" into "MyTable", and use that to replace the fully 
qualified name in the command text with the bare table name.  But when it comes 
to time to call the adapter's Update() method to add a new row into my table, 
the first thing the adapter does is to change the bare table name back to the 
full "MyDatabase.public.MyTable" name, and then I get the same exception.

Thank you very much.

RobR


-- 
Sent via pgsql-odbc mailing list (pgsql-odbc(at)postgresql(dot)org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc

In response to

Responses

pgsql-odbc by date

Next:From: Rob RichardsonDate: 2012-04-25 14:25:10
Subject: Re: How can I keep an OdbcDataAdapter from using fully qualified tble names?
Previous:From: Rob RichardsonDate: 2012-04-25 14:05:50
Subject: How can I keep an OdbcDataAdapter from using fully qualified tble names?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group