VS2008: Simple DataGridView not populating
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 <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
------=_NextPart_000_0034_01C893F7.D28F7000
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
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">
<head>
<meta http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
[at] font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
[at] font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
[at] font-face
{font-family:Garamond;
panose-1:2 2 4 4 3 3 1 1 8 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Garamond","serif";
color:windowtext;
font-weight:normal;
font-style:normal;}
..MsoChpDefault
{mso-style-type:export-only;}
[at] page Section1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=3DEN-US link=3Dblue vlink=3Dpurple>
<div class=3DSection1>
<p class=3DMsoNormal><b><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>Co ntext:<o:p></=
o:p></span></b></p>
<p class=3DMsoNormal><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'><o:p> </o:=
p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>Wi ndows
Vista x64<o:p></o:p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>Po stgreSQL
8.3 (server on localhost)<o:p></o:p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>ps ql-obdc
v8.03.01<o:p></o:p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>Vi sual
Studio 2008 (VS2008)<o:p></o:p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'><o:p> </o:=
p></span></p>
<p class=3DMsoNormal><b><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>Pr oblem:<o:p></=
o:p></span></b></p>
<p class=3DMsoNormal><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'><o:p> </o:=
p></span></p>
<p class=3DMsoNormal><span =
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 *<b>not</b>* =
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.<o:p></o:p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'><o:p> </o:=
p></span></p>
<p class=3DMsoNormal><span =
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.<o:p></o:p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'><o:p> </o:=
p></span></p>
<p class=3DMsoNormal><span =
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.<o:p></o:p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'><o:p> </o:=
p></span></p>
<p class=3DMsoNormal><span =
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.<o:p></o:p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'><o:p> </o:=
p></span></p>
<p class=3DMsoNormal><b><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>An alysis:<o:p><=
/o:p></span></b></p>
<p class=3DMsoNormal><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'><o:p> </o:=
p></span></p>
<p class=3DMsoNormal><span =
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. <o:p></o:p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'><o:p> </o:=
p></span></p>
<p class=3DMsoNormal><span =
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:<o:p></o:p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'><o:p> </o:=
p></span></p>
<p class=3DMsoNormal><span =
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.<o:p></o:p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'><o:p> </o:=
p></span></p>
<p class=3DMsoNormal><span =
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.<o:p></o:p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'><o:p> </o:=
p></span></p>
<p class=3DMsoNormal><span =
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?<o:p></o:p></span></p>
<p class=3DMsoNormal><b><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'><o:p> </o:=
p></span></b></p>
<p class=3DMsoNormal><b><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'><o:p> </o:=
p></span></b></p>
<p class=3DMsoNormal><b><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>Ch arles
S. Henkel<o:p></o:p></span></b></p>
<p class=3DMsoNormal><i><span =
style=3D'font-family:"Garamond","serif"'>Henkel
Technical Computing, LLC<o:p></o:p></span></i></p>
<p class=3DMsoNormal><span =
style=3D'font-size:10.0pt;font-family:"Garamond","serif"'>99 17
Laurel Springs Ave<o:p></o:p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:10.0pt;font-family:"Garamond","serif"'>La s
Vegas, NV 89134<o:p></o:p></span></p>
<p class=3DMsoNormal><o:p> </o:p></p>
</div>
</body>
</html>
------=_NextPart_000_0034_01C893F7.D28F7000--
Re: VS2008: Simple DataGridView not populating
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=2E If you are using VS 2008 and presumably =2ENET Framework,=
=0D=0Awhy are you not using the PostgreSQL ADO=2ENET driver instead of ODB=
C?=0D=0A =0D=0Ahttp://pgfoundry=2Eorg/projects/npgsql=0D=0A =0D=0A =0D=0A=
=0D=0A________________________________=0D=0A=0D=0AFrom: pgsql-odbc-owner [at] po=
stgresql=2Eorg=0D=0A[mailto:pgsql-odbc-owner [at] postgresql=2Eor g] On Behalf Of=
Charles S=2E Henkel=0D=0ASent: Tuesday, April 01, 2008 3:57 PM=0D=0ATo: pg=
sql-odbc [at] postgresql=2Eorg=0D=0ASubject: [ODBC] VS2008: Simple DataGridView =
not populating=0D=0A=0D=0A=0D=0A=0D=0AContext:=0D=0A=0D=0A =0D=0A=0D=0AWind=
ows Vista x64=0D=0A=0D=0APostgreSQL 8=2E3 (server on localhost)=0D=0A=0D=0A=
psql-obdc v8=2E03=2E01=0D=0A=0D=0AVisual Studio 2008 (VS2008)=0D=0A=0D=0A =
=0D=0A=0D=0AProblem:=0D=0A=0D=0A =0D=0A=0D=0AI created a System DSN using t=
he Data Sources (ODBC) administration tool=0D=0Alocated in <system>\SysWOW6=
4\odbcad32=2Eexe=2E Note that this is *not* the=0D=0Asame one you get from =
Control Panel ->Administrative Tools (that one is=0D=0Ain <system>/system32=
and can apparently only manage 64 bit DSNs)=2E Test=0D=0Asuccessful=2E=0D=
=0A=0D=0A =0D=0A=0D=0AIn VS2008, add new Data Source picking up one table f=
rom the DSN just=0D=0Acreated=2E On Data Sources tab, can rightclick the t=
able and "Preview=0D=0AData"=2E=2E=2Eworks fine in the IDE, successfully re=
trieving data from the=0D=0Adatabase=2E=0D=0A=0D=0A =0D=0A=0D=0ACreate a tr=
ivial Windows Forms Application with a DataGridView [DGV]=0D=0Acontrol=2E N=
o code-behind=2E=2E=2Ejust connect the DGV Data Source to the DSN=0D=0Atabl=
e=2E Run the application=2E=2E=2Eno data in DGV=2E=0D=0A=0D=0A =0D=0A=0D=0A=
Do exact same thing except with Northwind DSN (sample SQL Server=0D=0Adatab=
ase, not using PostgreSQL or psql-odbc)=2E=2E=2Erun app=2E=2E=2EDGV populat=
es=0D=0Ajust fine=2E=0D=0A=0D=0A =0D=0A=0D=0AAnalysis:=0D=0A=0D=0A =0D=0A=
=0D=0AEnabling mylog in psql-odbc doesn't give much information=2E If I log=
the=0D=0AVS2008 IDE interaction with the DSN (e=2Eg=2E, when using "Previe=
w=0D=0AData")=2E=2E=2Eit all looks good=2E =0D=0A=0D=0A =0D=0A=0D=0AIf I co=
mpile the app and execute it with mylog enabled=2E=2E=2Enothing in the=0D=
=0Alog file except the intialization from turning on logging=2E That is, th=
e=0D=0Aapp never finds the DSN, and in fact gives an error to that effect:=
=0D=0A=0D=0A =0D=0A=0D=0A[ERROR] [IM002] [Microsoft] [ODBC Driver Manager] =
Data source name not=0D=0Afound and no default driver specified=2E=0D=0A=0D=
=0A =0D=0A=0D=0ASo it appears that this may be an x64 issue=2E=2E=2EThe app=
lication can't find=0D=0Athe DSN probably because there is no entry for it =
in=0D=0AHKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC=2EINI=2E=2E=2E instead the ent=
ry is in the=0D=0Aredirected key HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\OD=
BC\ODBC=2EINI but=0D=0Ait's not getting redirected there=2E=0D=0A=0D=0A =0D=
=0A=0D=0AI can't understand why the VS2008 IDE can interact with the DSN ju=
st=0D=0Afine, but the simple app can't find it=2E Perhaps there's a "target=
=0D=0Aplatform" I have to specify? Any ideas?=0D=0A=0D=0A =0D=0A=0D=0A =0D=
=0A=0D=0ACharles S=2E Henkel=0D=0A=0D=0AHenkel Technical Computing, LLC=0D=
=0A=0D=0A9917 Laurel Springs Ave=0D=0A=0D=0ALas Vegas, NV 89134=0D=0A=0D=
=0A =0D=0A=0D=0A=0D=0A=0D=0A------------------------------------ -----=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=2E It is intended=0D=0Asolely for the addressee=2E If you recei=
ved this in error, please=0Acontact the sender and delete the material from=
any computer=2E=0D=0A
------_=_NextPart_001_01C89436.C9A4F2C7
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4=2E0 Transitional//EN">=0D=0A<HTML=
xmlns=3D"http://www=2Ew3=2Eorg/TR/REC-html40" xmlns:v =3D =0D=0A"urn:schem=
as-microsoft-com:vml" xmlns:o =3D =0D=0A"urn:schemas-microsoft-com:office:o=
ffice" xmlns:w =3D =0D=0A"urn:schemas-microsoft-com:office:word" xmlns:m =
=3D =0D=0A"http://schemas=2Emicrosoft=2Ecom/office/2004/12/omml" ><HEAD>=0D=
=0A<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dus-ascii=
">=0D=0A<META content=3D"MSHTML 6=2E00=2E6000=2E16481" name=3DGENERATOR>=0D=
=0A<STYLE> [at] font-face {=0D=0A font-family: Cambria Math;=0D=0A}=0D=0A [at] font-f=
ace {=0D=0A font-family: Calibri;=0D=0A}=0D=0A [at] font-face {=0D=0A font-famil=
y: Garamond;=0D=0A}=0D=0A [at] page Section1 {size: 8=2E5in 11=2E0in; margin: 1=
=2E0in 1=2E0in 1=2E0in 1=2E0in; }=0D=0AP=2EMsoNormal {=0D=0A FONT-SIZE: 11p=
t; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Calibri","sans-serif"=0D=0A}=0D=0ALI=
=2EMsoNormal {=0D=0A FONT-SIZE: 11pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Ca=
libri","sans-serif"=0D=0A}=0D=0ADIV=2EMsoNormal {=0D=0A FONT-SIZE: 11pt; MA=
RGIN: 0in 0in 0pt; FONT-FAMILY: "Calibri","sans-serif"=0D=0A}=0D=0AA:link {=
=0D=0A COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99=0D=
=0A}=0D=0ASPAN=2EMsoHyperlink {=0D=0A COLOR: blue; TEXT-DECORATION: underli=
ne; mso-style-priority: 99=0D=0A}=0D=0AA:visited {=0D=0A COLOR: purple; TEX=
T-DECORATION: underline; mso-style-priority: 99=0D=0A}=0D=0ASPAN=2EMsoHyper=
linkFollowed {=0D=0A COLOR: purple; TEXT-DECORATION: underline; mso-style-p=
riority: 99=0D=0A}=0D=0ASPAN=2EEmailStyle17 {=0D=0A FONT-WEIGHT: normal; CO=
LOR: windowtext; FONT-STYLE: normal; FONT-FAMILY: "Garamond","serif"; mso-s=
tyle-type: personal-compose=0D=0A}=0D=0A=2EMsoChpDefault {=0D=0A mso-style-=
type: export-only=0D=0A}=0D=0ADIV=2ESection1 {=0D=0A page: Section1=0D=0A}=
=0D=0A</STYLE>=0D=0A<!--[if gte mso 9]><xml>=0D=0A <o:shapedefaults v:ext=
=3D"edit" spidmax=3D"1026" />=0D=0A</xml><![endif]--><!--[if gte mso 9]><xm=
l>=0D=0A <o:shapelayout v:ext=3D"edit">=0D=0A <o:idmap v:ext=3D"edit" data=
=3D"1" />=0D=0A </o:shapelayout></xml><![endif]--></HEAD>=0D=0A<BODY lang=
=3DEN-US vLink=3Dpurple link=3Dblue>=0D=0A<DIV dir=3Dltr align=3Dleft><SPAN=
class=3D634042520-01042008><FONT face=3DArial =0D=0Acolor=3D#0000ff size=
=3D2>One question=2E If you are using VS 2008 and presumably =0D=0A=
=2ENET Framework, why are you not using the PostgreSQL ADO=2ENET driv=
er =0D=0Ainstead of ODBC?</FONT></SPAN></DIV>=0D=0A<DIV dir=3Dltr align=3Dl=
eft><SPAN class=3D634042520-01042008><FONT face=3DArial =0D=0Acolor=3D#0000=
ff size=3D2></FONT></SPAN> </DIV>=0D=0A<DIV dir=3Dltr align=3Dleft><SP=
AN class=3D634042520-01042008><FONT face=3DArial =0D=0Acolor=3D#0000ff size=
=3D2><A =0D=0Ahref=3D"http://pgfoundry=2Eorg/projects/npgsql">http://pgfoun=
dry=2Eorg/projects/npgsql</A></FONT></SPAN></DIV>=0D=0A<DIV dir=3Dltr align=
=3Dleft><SPAN class=3D634042520-01042008><FONT face=3DArial =0D=0Acolor=3D#=
0000ff size=3D2></FONT></SPAN> </DIV>=0D=0A<DIV dir=3Dltr align=3Dleft=
><SPAN class=3D634042520-01042008><FONT face=3DArial =0D=0Acolor=3D#0000ff =
size=3D2></FONT></SPAN> </DIV><BR>=0D=0A<DIV class=3DOutlookMessageHea=
der lang=3Den-us dir=3Dltr align=3Dleft>=0D=0A<HR tabIndex=3D-1>=0D=0A<FONT=
face=3DTahoma size=3D2><B>From:</B> pgsql-odbc-owner [at] postgresql=2Eorg =0D=
=0A[mailto:pgsql-odbc-owner [at] postgresql=2Eorg] <B>On Behalf Of </B>Charles S=
=2E =0D=0AHenkel<BR><B>Sent:</B> Tuesday, April 01, 2008 3:57 PM<BR><B>To:<=
/B> =0D=0Apgsql-odbc [at] postgresql=2Eorg<BR><B>Subject:</B> [ODBC] VS2008: Sim=
ple DataGridView =0D=0Anot populating<BR></FONT><BR></DIV>=0D=0A<DIV></DIV>=
=0D=0A<DIV class=3DSection1>=0D=0A<P class=3DMsoNormal><B><SPAN =0D=0Astyle=
=3D"FONT-SIZE: 12pt; FONT-FAMILY: 'Garamond','serif'">Context:<o:p></o:p></=
SPAN></B></P>=0D=0A<P class=3DMsoNormal><SPAN =0D=0Astyle=3D"FONT-SIZE: 12p=
t; FONT-FAMILY: 'Garamond','serif'"><o:p> </o:p></SPAN></P>=0D=0A<P cl=
ass=3DMsoNormal><SPAN =0D=0Astyle=3D"FONT-SIZE: 12pt; FONT-FAMILY: 'Garamon=
d','serif'">Windows Vista =0D=0Ax64<o:p></o:p></SPAN></P>=0D=0A<P class=3DM=
soNormal><SPAN =0D=0Astyle=3D"FONT-SIZE: 12pt; FONT-FAMILY: 'Garamond','ser=
if'">PostgreSQL 8=2E3 (server =0D=0Aon localhost)<o:p></o:p></SPAN></P>=0D=
=0A<P class=3DMsoNormal><SPAN =0D=0Astyle=3D"FONT-SIZE: 12pt; FONT-FAMILY: =
'Garamond','serif'">psql-obdc =0D=0Av8=2E03=2E01<o:p></o:p></SPAN></P>=0D=
=0A<P class=3DMsoNormal><SPAN =0D=0Astyle=3D"FONT-SIZE: 12pt; FONT-FAMILY: =
'Garamond','serif'">Visual Studio 2008 =0D=0A(VS2008)<o:p></o:p></SPAN></P>=
=0D=0A<P class=3DMsoNormal><SPAN =0D=0Astyle=3D"FONT-SIZE: 12pt; FONT-FAMIL=
Y: 'Garamond','serif'"><o:p> </o:p></SPAN></P>=0D=0A<P class=3DMsoNorm=
al><B><SPAN =0D=0Astyle=3D"FONT-SIZE: 12pt; FONT-FAMILY: 'Garamond','serif'=
">Problem:<o:p></o:p></SPAN></B></P>=0D=0A<P class=3DMsoNormal><SPAN =0D=0A=
style=3D"FONT-SIZE: 12pt; FONT-FAMILY: 'Garamond','serif'"><o:p> </o:p=
></SPAN></P>=0D=0A<P class=3DMsoNormal><SPAN =0D=0Astyle=3D"FONT-SIZE: 12pt=
; FONT-FAMILY: 'Garamond','serif'">I created a System DSN =0D=0Ausing the D=
ata Sources (ODBC) administration tool located in =0D=0A<system>\SysW=
OW64\odbcad32=2Eexe=2E Note that this is *<B>not</B>* the same =0D=0Aone yo=
u get from Control Panel ->Administrative Tools (that one is in =0D=0A&l=
t;system>/system32 and can apparently only manage 64 bit DSNs)=2E Test =
=0D=0Asuccessful=2E<o:p></o:p></SPAN></P>=0D=0A<P class=3DMsoNormal><SPAN =
=0D=0Astyle=3D"FONT-SIZE: 12pt; FONT-FAMILY: 'Garamond','serif'"><o:p> =
;</o:p></SPAN></P>=0D=0A<P class=3DMsoNormal><SPAN =0D=0Astyle=3D"FONT-SIZE=
: 12pt; FONT-FAMILY: 'Garamond','serif'">In VS2008, add new Data =0D=0ASour=
ce picking up one table from the DSN just created=2E On Data Sources =
=0D=0Atab, can rightclick the table and "Preview Data"=2E=2E=2Eworks fine i=
n the IDE, =0D=0Asuccessfully retrieving data from the database=2E<o:p></o:=
p></SPAN></P>=0D=0A<P class=3DMsoNormal><SPAN =0D=0Astyle=3D"FONT-SIZE: 12p=
t; FONT-FAMILY: 'Garamond','serif'"><o:p> </o:p></SPAN></P>=0D=0A<P cl=
ass=3DMsoNormal><SPAN =0D=0Astyle=3D"FONT-SIZE: 12pt; FONT-FAMILY: 'Garamon=
d','serif'">Create a trivial =0D=0AWindows Forms Application with a DataGri=
dView [DGV] control=2E No =0D=0Acode-behind=2E=2E=2Ejust connect the DGV Da=
ta Source to the DSN table=2E Run the =0D=0Aapplication=2E=2E=2Eno data in =
DGV=2E<o:p></o:p></SPAN></P>=0D=0A<P class=3DMsoNormal><SPAN =0D=0Astyle=3D=
"FONT-SIZE: 12pt; FONT-FAMILY: 'Garamond','serif'"><o:p> </o:p></SPAN>=
</P>=0D=0A<P class=3DMsoNormal><SPAN =0D=0Astyle=3D"FONT-SIZE: 12pt; FONT-F=
AMILY: 'Garamond','serif'">Do exact same thing =0D=0Aexcept with Northwind =
DSN (sample SQL Server database, not using PostgreSQL or =0D=0Apsql-odbc)=
=2E=2E=2Erun app=2E=2E=2EDGV populates just fine=2E<o:p></o:p></SPAN></P>=
=0D=0A<P class=3DMsoNormal><SPAN =0D=0Astyle=3D"FONT-SIZE: 12pt; FONT-FAMIL=
Y: 'Garamond','serif'"><o:p> </o:p></SPAN></P>=0D=0A<P class=3DMsoNorm=
al><B><SPAN =0D=0Astyle=3D"FONT-SIZE: 12pt; FONT-FAMILY: 'Garamond','serif'=
">Analysis:<o:p></o:p></SPAN></B></P>=0D=0A<P class=3DMsoNormal><SPAN =0D=
=0Astyle=3D"FONT-SIZE: 12pt; FONT-FAMILY: 'Garamond','serif'"><o:p> </=
o:p></SPAN></P>=0D=0A<P class=3DMsoNormal><SPAN =0D=0Astyle=3D"FONT-SIZE: 1=
2pt; FONT-FAMILY: 'Garamond','serif'">Enabling mylog in =0D=0Apsql-odbc doe=
sn't give much information=2E If I log the VS2008 IDE interaction =0D=0Awit=
h the DSN (e=2Eg=2E, when using "Preview Data")=2E=2E=2Eit all looks good=
=2E =0D=0A<o:p></o:p></SPAN></P>=0D=0A<P class=3DMsoNormal><SPAN =0D=0Astyl=
e=3D"FONT-SIZE: 12pt; FONT-FAMILY: 'Garamond','serif'"><o:p> </o:p></S=
PAN></P>=0D=0A<P class=3DMsoNormal><SPAN =0D=0Astyle=3D"FONT-SIZE: 12pt; FO=
NT-FAMILY: 'Garamond','serif'">If I compile the app =0D=0Aand execute it wi=
th mylog enabled=2E=2E=2Enothing in the log file except the =0D=0Aintializa=
tion from turning on logging=2E That is, the app never finds the DSN, and =
=0D=0Ain fact gives an error to that effect:<o:p></o:p></SPAN></P>=0D=0A<P =
class=3DMsoNormal><SPAN =0D=0Astyle=3D"FONT-SIZE: 12pt; FONT-FAMILY: 'Garam=
ond','serif'"><o:p> </o:p></SPAN></P>=0D=0A<P class=3DMsoNormal><SPAN =
=0D=0Astyle=3D"FONT-SIZE: 12pt; FONT-FAMILY: 'Garamond','serif'">[ERROR] [I=
M002] =0D=0A[Microsoft] [ODBC Driver Manager] Data source name not found an=
d no default =0D=0Adriver specified=2E<o:p></o:p></SPAN></P>=0D=0A<P class=
=3DMsoNormal><SPAN =0D=0Astyle=3D"FONT-SIZE: 12pt; FONT-FAMILY: 'Garamond',=
'serif'"><o:p> </o:p></SPAN></P>=0D=0A<P class=3DMsoNormal><SPAN =0D=
=0Astyle=3D"FONT-SIZE: 12pt; FONT-FAMILY: 'Garamond','serif'">So it appears=
that this =0D=0Amay be an x64 issue=2E=2E=2EThe application can't find the=
DSN probably because there =0D=0Ais no entry for it in HKEY_LOCAL_MACHINE\=
SOFTWARE\ODBC\ODBC=2EINI=2E=2E=2Einstead the =0D=0Aentry is in the redirect=
ed key =0D=0AHKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ODBC\ODBC=2EIN I but it=
's not getting =0D=0Aredirected there=2E<o:p></o:p></SPAN></P>=0D=0A<P clas=
s=3DMsoNormal><SPAN =0D=0Astyle=3D"FONT-SIZE: 12pt; FONT-FAMILY: 'Garamond'=
,'serif'"><o:p> </o:p></SPAN></P>=0D=0A<P class=3DMsoNormal><SPAN =0D=
=0Astyle=3D"FONT-SIZE: 12pt; FONT-FAMILY: 'Garamond','serif'">I can't under=
stand why =0D=0Athe VS2008 IDE can interact with the DSN just fine, but the=
simple app can't =0D=0Afind it=2E Perhaps there's a "target platform" I ha=
ve to specify? Any =0D=0Aideas?<o:p></o:p></SPAN></P>=0D=0A<P class=3DMsoNo=
rmal><B><SPAN =0D=0Astyle=3D"FONT-SIZE: 12pt; FONT-FAMILY: 'Garamond','seri=
f'"><o:p> </o:p></SPAN></B></P>=0D=0A<P class=3DMsoNormal><B><SPAN =0D=
=0Astyle=3D"FONT-SIZE: 12pt; FONT-FAMILY: 'Garamond','serif'"><o:p> </=
o:p></SPAN></B></P>=0D=0A<P class=3DMsoNormal><B><SPAN =0D=0Astyle=3D"FONT-=
SIZE: 12pt; FONT-FAMILY: 'Garamond','serif'">Charles S=2E =0D=0AHenkel<o:p>=
</o:p></SPAN></B></P>=0D=0A<P class=3DMsoNormal><I><SPAN style=3D"FONT-FAMI=
LY: 'Garamond','serif'">Henkel =0D=0ATechnical Computing, LLC<o:p></o:p></S=
PAN></I></P>=0D=0A<P class=3DMsoNormal><SPAN =0D=0Astyle=3D"FONT-SIZE: 10pt=
; FONT-FAMILY: 'Garamond','serif'">9917 Laurel Springs =0D=0AAve<o:p></o:p>=
</SPAN></P>=0D=0A<P class=3DMsoNormal><SPAN =0D=0Astyle=3D"FONT-SIZE: 10pt;=
FONT-FAMILY: 'Garamond','serif'">Las Vegas, NV =0D=0A89134<o:p></o:p=
></SPAN></P>=0D=0A<P class=3DMsoNormal><o:p> </o:p></P></DIV></BODY></=
HTML>=0D=0A=0D=0A
------_=_NextPart_001_01C89436.C9A4F2C7--
Re: VS2008: Simple DataGridView not populating
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
<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
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">
<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
[at] font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
[at] font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
[at] font-face
{font-family:Garamond;
panose-1:2 2 4 4 3 3 1 1 8 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal;
font-family:"Garamond","serif";
color:windowtext;
font-weight:normal;
font-style:normal;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Garamond","serif";
color:windowtext;
font-weight:normal;
font-style:normal;}
..MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
[at] page Section1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=3DEN-US link=3Dblue vlink=3Dpurple>
<div class=3DSection1>
<p class=3DMsoNormal><b><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>So lution:<o:p><=
/o:p></span></b></p>
<p class=3DMsoNormal><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'><o:p> </o:=
p></span></p>
<p class=3DMsoNormal><span =
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.<o:p></o:p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'><o:p> </o:=
p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>I
corrected the problem by setting the Target CPU to =
"x86".<o:p></o:p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'><o:p> </o:=
p></span></p>
<p class=3DMsoNormal><span =
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.<o:p></o:p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'><o:p> </o:=
p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'><o:p> </o:=
p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'><o:p> </o:=
p></span></p>
<div>
<p class=3DMsoNormal><b><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>Ch arles
S. Henkel<o:p></o:p></span></b></p>
<p class=3DMsoNormal><i><span =
style=3D'font-family:"Garamond","serif"'>Henkel
Technical Computing, LLC<o:p></o:p></span></i></p>
<p class=3DMsoNormal><span =
style=3D'font-size:10.0pt;font-family:"Garamond","serif"'>99 17
Laurel Springs Ave<o:p></o:p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:10.0pt;font-family:"Garamond","serif"'>La s
Vegas, NV 89134<o:p></o:p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:10.0pt;font-family:"Garamond","serif"'>(7 02)405-0945
Home<o:p></o:p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:10.0pt;font-family:"Garamond","serif"'>(7 04)877-1966
Cell<o:p></o:p></span></p>
</div>
<p class=3DMsoNormal><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'><o:p> </o:=
p></span></p>
</div>
</body>
</html>
------=_NextPart_000_0046_01C893FE.0BF71EA0--