GIDForums  

Go Back   GIDForums > Computer Programming Forums > MS Visual C++ / MFC Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 18-Apr-2008, 08:35
leo_83 leo_83 is offline
New Member
 
Join Date: Apr 2008
Posts: 2
leo_83 is on a distinguished road

Visual C++ and postgres!


Hello ,

What works
I have built a application in Visual Basic (Visual Studio 200 to connect my application to postgres database using add datasource procedure (ODBC)and most of the controls i need to read,write,update to/from database i.e. insert and delete data are created on bindingnavigator and work fine. Please see a snapshot. I believe most experts here would be quite familiar with this.

what I seek?
The need of my current project is to implement the same feature using Visual C++ .
I am unaware if this could be implemented more or less in the same way as i did in Visual basic and need your advice/suggestion, how do i proceed.

importantly i was playing around visualc++ and created more or less a succesfull connection to postgres using following.
MFC Application Wizard -> Database support

Choose : Database view with file support
ODBC (Client type)
and proceeding thereafter . connection is tested successfully ,no wonder but form also shows a application menu Record on menu bar, however i fail to access the records.

Please let me know your advice to help me proceed further. Any example, weblink would be simply great.

thanks,
Regrds
Abhi
  #2  
Old 21-Apr-2008, 02:04
Jana Jana is offline
New Member
 
Join Date: Apr 2008
Posts: 10
Jana is on a distinguished road

Re: Visual C++ and postgres!


Hi there....
I'm not that gud in VC++..But i have some bad experience on it.
I was also put in the same position..But I just wanna share what I happened to me and what I did...

I had to modify an existing file-based MFC VC++ application to store the information to MySQL.. I was having problems with the wizard because my project was being converted from old versions of visual studio and it seems that there were lots of issues to be sorted....

Since the wizard didn't work well with the database, I had to go for the manual way....
I ended up with the following problems...

- it was an unmanaged C++ program. So we cant simply include any dlls. The reason is unclear(I don;t know). /CLR option is needed if we are using #using .

- I tried to use mysql.data.dll .This is an ADO connector. But couldnt get it right..

- I also tried to use the MySql C++ libraries. I was not competent enough to use it


Since my project is a complicated one..I didn't know what to do..


Finally I withdrew from the C++ application and created a VB .NET application to handle the data , database and results and executed this particular vb .net application from the c++ application using the createprocess()

I used ODBC driver for MySQL with the VB .NET application



I know I wrote lot of unwanted stuffs for your question...I just wanna share this...thats all...
Gud luck with ur application...

Cheers
Jana
  #3  
Old 21-Apr-2008, 02:27
leo_83 leo_83 is offline
New Member
 
Join Date: Apr 2008
Posts: 2
leo_83 is on a distinguished road

Re: Visual C++ and postgres!


Finally I withdrew from the C++ application and created a VB .NET application to handle the data , database and results and executed this particular vb .net application from the c++ application using the createprocess()

Hi Jana,

Well..!! i already have a a vb. net application which i can use to handle my database., Could you throw some more light on how to create and use createprocess().Is tthere any wizard available..how do i proceed with this?
please let me know
Thanks,
Abhi
  #4  
Old 21-Apr-2008, 21:03
Jana Jana is offline
New Member
 
Join Date: Apr 2008
Posts: 10
Jana is on a distinguished road

Re: Visual C++ and postgres!


Source: forums.devx.com

Here is the code which does the trick which was copied from the above link....

#############################

STARTUPINFO si = {0};
PROCESS_INFORMATION pi = {0};
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );

TCHAR szCommandLine[] = _T("\"C:\\Windows\\system32\\calc.exe\"");
if( !CreateProcess( NULL, szCommandLine, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi ) )
{
_tprintf( _T("CreateProcess failed - %d\n"), GetLastError() );
return;
}

WaitForSingleObject( pi.hProcess, INFINITE );
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );

------------------------------

I'm not familiar with any wizards as they don't work for my projects.. But if you are starting from scratch, then you can create dialog boxes/forms and connect your class to them and do your thing....
 
 

Recent GIDBlogLast Week of IA Training by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 15:21.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.