pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
VS2008: Simple DataGridView not populating
3+ messages / 2 participants
[nested] [flat]

* VS2008: Simple DataGridView not populating
@ 2008-04-01 19:56  Charles S. Henkel <csh@henktech.com>
  0 siblings, 2 replies; 3+ messages in thread

From: Charles S. Henkel @ 2008-04-01 19:56 UTC (permalink / raw)
  To: pgsql-odbc

Context:

 

Windows Vista x64

PostgreSQL 8.3 (server on localhost)

psql-obdc v8.03.01

Visual Studio 2008 (VS2008)

 

Problem:

 

I created a System DSN using the Data Sources (ODBC) administration tool
located in <system>\SysWOW64\odbcad32.exe. Note that this is *not* the same
one you get from Control Panel ->Administrative Tools (that one is in
<system>/system32 and can apparently only manage 64 bit DSNs). Test
successful.

 

In VS2008, add new Data Source picking up one table from the DSN just
created.  On Data Sources tab, can rightclick the table and "Preview
Data"...works fine in the IDE, successfully retrieving data from the
database.

 

Create a trivial Windows Forms Application with a DataGridView [DGV]
control. No code-behind...just connect the DGV Data Source to the DSN table.
Run the application...no data in DGV.

 

Do exact same thing except with Northwind DSN (sample SQL Server database,
not using PostgreSQL or psql-odbc)...run app...DGV populates just fine.

 

Analysis:

 

Enabling mylog in psql-odbc doesn't give much information. If I log the
VS2008 IDE interaction with the DSN (e.g., when using "Preview Data")...it
all looks good. 

 

If I compile the app and execute it with mylog enabled...nothing in the log
file except the intialization from turning on logging. That is, the app
never finds the DSN, and in fact gives an error to that effect:

 

[ERROR] [IM002] [Microsoft] [ODBC Driver Manager] Data source name not found
and no default driver specified.

 

So it appears that this may be an x64 issue...The application can't find the
DSN probably because there is no entry for it in
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI...instead the entry is in the
redirected key HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ODBC\ODBC.INI but
it's not getting redirected there.

 

I can't understand why the VS2008 IDE can interact with the DSN just fine,
but the simple app can't find it. Perhaps there's a "target platform" I have
to specify? Any ideas?

 

 

Charles S. Henkel

Henkel Technical Computing, LLC

9917 Laurel Springs Ave

Las Vegas, NV  89134

 

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: VS2008: Simple DataGridView not populating
@ 2008-04-01 20:27  Obe, Regina <robe.dnd@cityofboston.gov>
  parent: Charles S. Henkel <csh@henktech.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Obe, Regina @ 2008-04-01 20:27 UTC (permalink / raw)
  To: Charles S. Henkel <csh@henktech.com>; pgsql-odbc

One question.  If you are using VS 2008 and presumably .NET Framework,
why are you not using the PostgreSQL ADO.NET  driver instead of ODBC?
 
http://pgfoundry.org/projects/npgsql
 
 

________________________________

From: pgsql-odbc-owner@postgresql.org
[mailto:pgsql-odbc-owner@postgresql.org] On Behalf Of Charles S. Henkel
Sent: Tuesday, April 01, 2008 3:57 PM
To: pgsql-odbc@postgresql.org
Subject: [ODBC] VS2008: Simple DataGridView not populating



Context:

 

Windows Vista x64

PostgreSQL 8.3 (server on localhost)

psql-obdc v8.03.01

Visual Studio 2008 (VS2008)

 

Problem:

 

I created a System DSN using the Data Sources (ODBC) administration tool
located in <system>\SysWOW64\odbcad32.exe. Note that this is *not* the
same one you get from Control Panel ->Administrative Tools (that one is
in <system>/system32 and can apparently only manage 64 bit DSNs). Test
successful.

 

In VS2008, add new Data Source picking up one table from the DSN just
created.  On Data Sources tab, can rightclick the table and "Preview
Data"...works fine in the IDE, successfully retrieving data from the
database.

 

Create a trivial Windows Forms Application with a DataGridView [DGV]
control. No code-behind...just connect the DGV Data Source to the DSN
table. Run the application...no data in DGV.

 

Do exact same thing except with Northwind DSN (sample SQL Server
database, not using PostgreSQL or psql-odbc)...run app...DGV populates
just fine.

 

Analysis:

 

Enabling mylog in psql-odbc doesn't give much information. If I log the
VS2008 IDE interaction with the DSN (e.g., when using "Preview
Data")...it all looks good. 

 

If I compile the app and execute it with mylog enabled...nothing in the
log file except the intialization from turning on logging. That is, the
app never finds the DSN, and in fact gives an error to that effect:

 

[ERROR] [IM002] [Microsoft] [ODBC Driver Manager] Data source name not
found and no default driver specified.

 

So it appears that this may be an x64 issue...The application can't find
the DSN probably because there is no entry for it in
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI...instead the entry is in the
redirected key HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ODBC\ODBC.INI but
it's not getting redirected there.

 

I can't understand why the VS2008 IDE can interact with the DSN just
fine, but the simple app can't find it. Perhaps there's a "target
platform" I have to specify? Any ideas?

 

 

Charles S. Henkel

Henkel Technical Computing, LLC

9917 Laurel Springs Ave

Las Vegas, NV  89134

 



-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: VS2008: Simple DataGridView not populating
@ 2008-04-01 20:41  Charles S. Henkel <csh@henktech.com>
  parent: Charles S. Henkel <csh@henktech.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Charles S. Henkel @ 2008-04-01 20:41 UTC (permalink / raw)
  To: pgsql-odbc

Solution:

 

I'm sorry this is clearly not a psql-odbc issue. However, I wanted to follow
up with a solution in case someone searches and finds my post.

 

I corrected the problem by setting the Target CPU to "x86".

 

In VS2008, go to Project->Project Properties...->Compile->Advanced Compile
Options...->Target CPU: and set it to "x86". Works fine.

 

 

 

Charles S. Henkel

Henkel Technical Computing, LLC

9917 Laurel Springs Ave

Las Vegas, NV  89134

(702)405-0945 Home

(704)877-1966 Cell

 

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2008-04-01 20:41 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-04-01 19:56 VS2008: Simple DataGridView not populating Charles S. Henkel <csh@henktech.com>
2008-04-01 20:27 ` Obe, Regina <robe.dnd@cityofboston.gov>
2008-04-01 20:41 ` Charles S. Henkel <csh@henktech.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox