VS2008: Simple DataGridView not populating

VS2008: Simple DataGridView not populating

am 01.04.2008 21:56:36 von csh

This is a multipart message in MIME format.

------=_NextPart_000_0034_01C893F7.D28F7000
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit

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 \SysWOW64\odbcad32.exe. Note that this is *not* the same
one you get from Control Panel ->Administrative Tools (that one is in
/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




------=_NextPart_000_0034_01C893F7.D28F7000
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
xmlns=3D"http://www.w3.org/TR/REC-html40">


charset=3Dus-ascii">









style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>Co ntext: o:p>



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>  p>



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>Wi ndows
Vista x64



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>Po stgreSQL
8.3 (server on localhost)



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>ps ql-obdc
v8.03.01



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>Vi sual
Studio 2008 (VS2008)



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>  p>



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>Pr oblem: o:p>



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>  p>



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>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.



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>  p>



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>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.



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>  p>



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>Cr eate
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.



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>  p>



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>Do
exact same thing except with Northwind DSN (sample SQL Server database, =
not
using PostgreSQL or psql-odbc)...run app...DGV populates just =
fine.



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>  p>



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>An alysis:<=
/o:p>



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>  p>



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>En abling
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.



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>  p>



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>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:



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>  p>



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>[E RROR]
[IM002] [Microsoft] [ODBC Driver Manager] Data source name not found and =
no
default driver specified.



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>  p>



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>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.



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>  p>



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>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?



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>  p>



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>  p>



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>Ch arles
S. Henkel



style=3D'font-family:"Garamond","serif"'>Henkel
Technical Computing, LLC



style=3D'font-size:10.0pt;font-family:"Garamond","serif"'>99 17
Laurel Springs Ave



style=3D'font-size:10.0pt;font-family:"Garamond","serif"'>La s
Vegas, NV  89134



 









------=_NextPart_000_0034_01C893F7.D28F7000--

Re: VS2008: Simple DataGridView not populating

am 01.04.2008 22:27:20 von robe.dnd

This is a multi-part message in MIME format.


------_=_NextPart_001_01C89436.C9A4F2C7
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

One question If you are using VS 2008 and presumably NET Framework,=
why are you not using the PostgreSQL ADONET driver instead of ODB=
C? http://pgfoundryorg/projects/npgsql =
________________________________ From: pgsql-odbc-owner@po=
stgresqlorg [mailto:pgsql-odbc-owner@postgresqlor g] On Behalf Of=
Charles S Henkel Sent: Tuesday, April 01, 2008 3:57 PM To: pg=
sql-odbc@postgresqlorg Subject: [ODBC] VS2008: Simple DataGridView =
not populating Context: Wind=
ows Vista x64 PostgreSQL 83 (server on localhost) =
psql-obdc v80301 Visual Studio 2008 (VS2008) =
Problem: I created a System DSN using t=
he Data Sources (ODBC) administration tool located in \SysWOW6=
4\odbcad32exe Note that this is *not* the same one you get from =
Control Panel ->Administrative Tools (that one is in /system32=
and can apparently only manage 64 bit DSNs) Test successful. =
=0A In VS2008, add new Data Source picking up one table f=
rom the DSN just created On Data Sources tab, can rightclick the t=
able and "Preview Data"..works fine in the IDE, successfully re=
trieving data from the database. =0A Create a tr=
ivial Windows Forms Application with a DataGridView [DGV] control N=
o code-behind..just connect the DGV Data Source to the DSN tabl=
e Run the application..no data in DGV. =0A =
Do exact same thing except with Northwind DSN (sample SQL Server datab=
ase, not using PostgreSQL or psql-odbc)..run app..DGV populat=
es just fine. =0A Analysis: =
Enabling mylog in psql-odbc doesn't give much information If I log=
the VS2008 IDE interaction with the DSN (eg, when using "Previe=
w Data")..it all looks good If I co=
mpile the app and execute it with mylog enabled..nothing in the=0D=
=0Alog file except the intialization from turning on logging That is, th=
e 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. =
=0A So it appears that this may be an x64 issue..The app=
lication can't find the DSN probably because there is no entry for it =
in HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINI.. instead the ent=
ry is in the redirected key HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\OD=
BC\ODBCINI but it's not getting redirected there. =0A =0D=
=0AI can't understand why the VS2008 IDE can interact with the DSN ju=
st fine, but the simple app can't find it Perhaps there's a "target=
platform" I have to specify? Any ideas? =0D=
=0ACharles S Henkel Henkel Technical Computing, LLC=0D=
=0A9917 Laurel Springs Ave Las Vegas, NV 89134 =0D=
=0A ------------------------------------ ----- =
The substance of this message, including any attachments, may be=0Aconfiden=
tial, legally privileged and/or exempt from disclosure=0Apursuant to Massac=
husetts law It is intended solely for the addressee If you recei=
ved this in error, please=0Acontact the sender and delete the material from=
any computer. =0A
------_=_NextPart_001_01C89436.C9A4F2C7
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

xmlns=3D"http://wwww3org/TR/REC-html40" xmlns:v =3D "urn:schem=
as-microsoft-com:vml" xmlns:o =3D "urn:schemas-microsoft-com:office:o=
ffice" xmlns:w =3D "urn:schemas-microsoft-com:office:word" xmlns:m =
=3D "http://schemasmicrosoftcom/office/2004/12/omml" >=0D=
=0A "> =0D=
=0A =3DEN-US vLink=3Dpurple link=3Dblue>

class=3D634042520-01042008> =3D2>One question  If you are using VS 2008 and presumably =
NET Framework, why are you not using the PostgreSQL ADONET  driv=
er instead of ODBC?
eft> ff size=3D2> 
AN class=3D634042520-01042008> =3D2>http://pgfoun=
dryorg/projects/npgsql
=3Dleft> 0000ff size=3D2> 
> size=3D2> 

der lang=3Den-us dir=3Dltr align=3Dleft>
face=3DTahoma size=3D2>From: pgsql-odbc-owner@postgresqlorg =0D=
=0A[mailto:pgsql-odbc-owner@postgresqlorg] On Behalf Of Charles S=
Henkel
Sent: Tuesday, April 01, 2008 3:57 PM
To:<=
/B> pgsql-odbc@postgresqlorg
Subject: [ODBC] VS2008: Sim=
ple DataGridView not populating

=

=3D"FONT-SIZE: 12pt; FONT-FAMILY: 'Garamond','serif'">Context: SPAN>

t; FONT-FAMILY: 'Garamond','serif'"> 

ass=3DMsoNormal> d','serif'">Windows Vista x64

soNormal> if'">PostgreSQL 83 (server on localhost)

=0D=
=0A

'Garamond','serif'">psql-obdc v80301

=0D=
=0A

'Garamond','serif'">Visual Studio 2008 (VS2008)

=

Y: 'Garamond','serif'"> 

al> ">Problem:

style=3D"FONT-SIZE: 12pt; FONT-FAMILY: 'Garamond','serif'">  >

; FONT-FAMILY: 'Garamond','serif'">I created a System DSN using the D=
ata Sources (ODBC) administration tool located in <system>\SysW=
OW64\odbcad32exe Note that this is *not* the same one yo=
u get from Control Panel ->Administrative Tools (that one is in &l=
t;system>/system32 and can apparently only manage 64 bit DSNs) Test =
successful

style=3D"FONT-SIZE: 12pt; FONT-FAMILY: 'Garamond','serif'"> =
;

: 12pt; FONT-FAMILY: 'Garamond','serif'">In VS2008, add new Data Sour=
ce picking up one table from the DSN just created  On Data Sources =
tab, can rightclick the table and "Preview Data"..works fine i=
n the IDE, successfully retrieving data from the database p>

t; FONT-FAMILY: 'Garamond','serif'"> 

ass=3DMsoNormal> d','serif'">Create a trivial Windows Forms Application with a DataGri=
dView [DGV] control No code-behind..just connect the DGV Da=
ta Source to the DSN table Run the application..no data in =
DGV

"FONT-SIZE: 12pt; FONT-FAMILY: 'Garamond','serif'"> =

AMILY: 'Garamond','serif'">Do exact same thing except with Northwind =
DSN (sample SQL Server database, not using PostgreSQL or psql-odbc)=
..run app..DGV populates just fine

=

Y: 'Garamond','serif'"> 

al> ">Analysis:

=0Astyle=3D"FONT-SIZE: 12pt; FONT-FAMILY: 'Garamond','serif'">  o:p>

2pt; FONT-FAMILY: 'Garamond','serif'">Enabling mylog in psql-odbc doe=
sn't give much information If I log the VS2008 IDE interaction wit=
h the DSN (eg, when using "Preview Data")..it all looks good=

e=3D"FONT-SIZE: 12pt; FONT-FAMILY: 'Garamond','serif'">  PAN>

NT-FAMILY: 'Garamond','serif'">If I compile the app and execute it wi=
th mylog enabled..nothing in the log file except the intializa=
tion from turning on logging That is, the app never finds the DSN, and =
in fact gives an error to that effect:

class=3DMsoNormal> ond','serif'"> 

style=3D"FONT-SIZE: 12pt; FONT-FAMILY: 'Garamond','serif'">[ERROR] [I=
M002] [Microsoft] [ODBC Driver Manager] Data source name not found an=
d no default driver specified

=3DMsoNormal> 'serif'"> 

=0Astyle=3D"FONT-SIZE: 12pt; FONT-FAMILY: 'Garamond','serif'">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\ODBCINI..instead the entry is in the redirect=
ed key HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ODBC\ODBCIN I but it=
's not getting redirected there

s=3DMsoNormal> ,'serif'"> 

=0Astyle=3D"FONT-SIZE: 12pt; FONT-FAMILY: 'Garamond','serif'">I can't under=
stand 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 ha=
ve to specify? Any ideas?

rmal> f'"> 

=0Astyle=3D"FONT-SIZE: 12pt; FONT-FAMILY: 'Garamond','serif'">  o:p>

SIZE: 12pt; FONT-FAMILY: 'Garamond','serif'">Charles S Henkel=

LY: 'Garamond','serif'">Henkel Technical Computing, LLC PAN>

; FONT-FAMILY: 'Garamond','serif'">9917 Laurel Springs Ave=

FONT-FAMILY: 'Garamond','serif'">Las Vegas, NV  89134 >

 

HTML>
------_=_NextPart_001_01C89436.C9A4F2C7--

Re: VS2008: Simple DataGridView not populating

am 01.04.2008 22:41:10 von csh

This is a multipart message in MIME format.

------=_NextPart_000_0046_01C893FE.0BF71EA0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit

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




------=_NextPart_000_0046_01C893FE.0BF71EA0
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
xmlns=3D"http://www.w3.org/TR/REC-html40">


charset=3Dus-ascii">









style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>So lution:<=
/o:p>



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>  p>



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>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.



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>  p>



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>I
corrected the problem by setting the Target CPU to =
"x86".



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>  p>



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>In
VS2008, go to Project->Project Properties...->Compile->Advanced
Compile Options...->Target CPU: and set it to "x86". Works =
fine.



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>  p>



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>  p>



style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>  p>





style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>Ch arles
S. Henkel



style=3D'font-family:"Garamond","serif"'>Henkel
Technical Computing, LLC



style=3D'font-size:10.0pt;font-family:"Garamond","serif"'>99 17
Laurel Springs Ave



style=3D'font-size:10.0pt;font-family:"Garamond","serif"'>La s
Vegas, NV  89134



style=3D'font-size:10.0pt;font-family:"Garamond","serif"'>(7 02)405-0945
Home



style=3D'font-size:10.0pt;font-family:"Garamond","serif"'>(7 04)877-1966
Cell





style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>  p>









------=_NextPart_000_0046_01C893FE.0BF71EA0--