Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Interfaces Odbc > VS2008: Simple ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 2329 of 2384
Post > Topic >>

VS2008: Simple DataGridView not populating

by csh@[EMAIL PROTECTED] ("Charles S. Henkel") Apr 1, 2008 at 12:56 PM

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 */
 @[EMAIL PROTECTED]
"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@[EMAIL PROTECTED]
 15 5 2 2 2 4 3 2 4;}
@[EMAIL PROTECTED]
 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:ex****t-only;}
@[EMAIL PROTECTED]
 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"'>Context:<o:p></=
o:p></span></b></p>

<p class=3DMsoNormal><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'><o:p>&nbsp;</o:=
p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>Windows
Vista x64<o:p></o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>PostgreSQL
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"'>psql-obdc
v8.03.01<o:p></o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>Visual
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>&nbsp;</o:=
p></span></p>

<p class=3DMsoNormal><b><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>Problem:<o:p></=
o:p></span></b></p>

<p class=3DMsoNormal><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'><o:p>&nbsp;</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 &lt;system&gt;\SysWOW64\odbcad32.exe. Note that this is *<b>not</b>* =
the
same one you get from Control Panel -&gt;Administrative Tools (that one =
is in
&lt;system&gt;/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>&nbsp;</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. &nbsp;On
Data Sources tab, can rightclick the table and &quot;Preview =
Data&quot;...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>&nbsp;</o:=
p></span></p>

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

<p class=3DMsoNormal><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'><o:p>&nbsp;</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>&nbsp;</o:=
p></span></p>

<p class=3DMsoNormal><b><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>Analysis:<o:p><=
/o:p></span></b></p>

<p class=3DMsoNormal><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'><o:p>&nbsp;</o:=
p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>Enabling
mylog in psql-odbc doesn't give much information. If I log the VS2008 =
IDE
interaction with the DSN (e.g., when using &quot;Preview =
Data&quot;)...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>&nbsp;</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>&nbsp;</o:=
p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>[ERROR]
[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>&nbsp;</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>&nbsp;</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 &quot;target =
platform&quot; 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>&nbsp;</o:=
p></span></b></p>

<p class=3DMsoNormal><b><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'><o:p>&nbsp;</o:=
p></span></b></p>

<p class=3DMsoNormal><b><span =
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>Charles
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"'>9917
Laurel Springs Ave<o:p></o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:10.0pt;font-family:"Garamond","serif"'>Las
Vegas, NV&nbsp; 89134<o:p></o:p></span></p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

</div>

</body>

</html>

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




 3 Posts in Topic:
VS2008: Simple DataGridView not populating
csh@[EMAIL PROTECTED] (&  2008-04-01 12:56:36 
Re: VS2008: Simple DataGridView not populating
robe.dnd@[EMAIL PROTECTED  2008-04-01 16:27:20 
Re: VS2008: Simple DataGridView not populating
csh@[EMAIL PROTECTED] (&  2008-04-01 13:41:10 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Thu Jul 24 7:07:45 CDT 2008.