Click here to Skip to main content
11,637,176 members (70,778 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C++/CLI PostgreSQL
Hi Guys!!
I'm beginner in Visual C++, so I want your help.
I wrote simple application, which need database (PostgreSQL). The source code in c++ is ok,
(I hope so Smile | :) ). In this application is DataViewGird which should connect to database and show me rows and column, but after compilation (without bugs) and running there is grey area without any tables.
I think, problem is in database. Of coruse I have added drivers for SQL to my project and directives in using namespaces. Below, I will show you my code and printscreen from pgAdminIII,where I create my database and there added four colums.

#pragma endregion
		private: NpgsqlConnection^ connection;
		private: NpgsqlCommand^ selectcomm;
private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) 
 connection = gcnew NpgsqlConnection("server=; Port=5030; UserId=postgres;  Database=utwory");
private: System::Void odswiez()
		selectcomm = gcnew NpgsqlCommand("select * from plyty", connection);
				 DataSet^ ds = gcnew DataSet("Dane o plytach");
				 NpgsqlDataAdapter^ adapter = gcnew   NpgsqlDataAdapter(selectcomm);
				 adapter ->Fill(ds);

I don't know what is wrong...
Do you have any tutorials for this or ideas how create database properly??
Posted 29-Apr-13 11:53am
ThePhantomUpvoter at 29-Apr-13 19:48pm
The very first thing that you should try..... is opening the connection to your database.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 stibee 313
1 295
2 OriginalGriff 295
3 himanshu agarwal 184
4 Sergey Alexandrovich Kryukov 154
0 OriginalGriff 9,031
1 Sergey Alexandrovich Kryukov 8,513
2 Mika Wendelius 6,922
3 F-ES Sitecore 2,388
4 Suvendu Shekhar Giri 2,320

Advertise | Privacy | Mobile
Web02 | 2.8.150728.1 | Last Updated 29 Apr 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100