|
I had a really bad experience with Microsoft and ADO in 2001.
I starting to understand it now, and figured out I can assign a value like LPWSTR to the return value.
For right now, I only need to do 5 things with SQL, Create Database, user, assign permissions, and create and populate the tables.
When this progrmam is finished, I'm going to look into MFC.
|
|
|
|
|
I understand. I started developing SQL DB apps back in 2002, ended up using ADO and C++. I equally hated and loved it.
FYI MFC is not needed to use ADO in C++.
Is it an option for you to use .NET? All this SQL DB stuff if SOOOOOOOOOOOOOOOO much easier in C# and .NET.
|
|
|
|
|
I wrote a eCommerce program in asp.net, that uses server control dll's. I've been trying to sell the program, but I need more users. I have a 99% failure rate on installation. So I wrote a Setup Wizard, one click app in asp.net, but when I added support for Vista and 7, it bombs on XP. Plus it's not 100% reliable. It's also a pain in the ** to deploy consistently.
So I decided to write a new setup wizard, this time in C++. I fired up my VS2010, and choose win32 project, not really knowing what it was. Now I almost have all the functionality I had before, almost done, and so far so good. It's works on XP', Vista and 7 in X86.
A long time ago, I wrote a eCommerce program in classic asp, and used ado for the database. Once a month the server would lock up, and not be able to communicate to the database server. I spent a week hunting down the issue, and it was the ado module, crashing from a 3Com hardware driver. There was no support with the issue, and felt helpless. My store was down for a week, and at any given moment in time, it could crash.
|
|
|
|
|
It sounds like a hardware problem.
Swapping your network card out (diff brand), may have solved all of your headaches.
I understand that you're gun shy now, but it has been a decade since you had that trouble with the 3Com Drivers.
|
|
|
|
|
I took me a month to figure out that the 3Com 3C 909 I think, a dual port 10/100 ethernet card was the problem, so I switched to Intel and Broadcom Chipset cards since them. Back then I had no idea how a hardware driver could only interfere with just talking to the MySQL Server, which was on board, and everything else still worked fine including the web server. So I concluded that the OBDC was evil, and stayed away from it since.
Long story short, I ended up going open source, LAMP, and regretted that as well, because I spent more time fixing issues with the programs, then actually writing programs. Found it was cheaper to just buy programs that work, and let someone else fix them.
Back to ODBC, I hear it's officially dead now. I think to the best of my knowledge!, like Ethernet, OLEDB has become the standard now, and ODBC was like token-ring, good idea, but lost out in the end. I may be wrong, just my opinion.
Oh, I'm still using that 3Com card in a CentOS Linux Server right now. LOL!
I know I was talking about ADO in the last post, I still stay away from both of them.
|
|
|
|
|
I ran into a number of cards that had bad drivers back in the day.
The issue was in persistent connections. There were protocol stack bugs.
You wouldn't see it on web servers, especially then, because connections aren't persistent.
I still use ODBC. It's not dead. The OleDB layer rests on top of it.
|
|
|
|
|
I thought it was the other way around. I don't remember anymore, last week was the first time in 5 years that I investigated it again. I'll look into ODBC again later in the month, but if the SQLCLIN10 works out for me, then I'll just stick with it. I kind of like it, It's an eye opener into how the whole process works.
|
|
|
|
|
I just read an article where Microsoft has announced the end of oledb, and will support ODBC only in future releases of SQL Server starting with 2012. I remember when they announced the end of Visual Basic to.
So I better start looking for ODBC examples, and perhaps rewrite my stuff.
|
|
|
|
|
I have a program that allows me to do some processing from menu resource in my program and I would like to access it from a dialog box. Currently, the member function autoplane() is defined in my WinSTMView class and I would like to member function to be accessed in ScanAcq Class. I tried to accomplish this by doing the following:
void CDlg_ScanAcq::OnBnClickedScanProcess()
{
OnPlaceData();
CWinSTMView *pView;
pView->OnImageAutoPlane();
}
Any suggestions on what I am doing wrong? I have tried to load the all the correct header files.
[modified]
This is repeated in the comments, but it will also help to give more information about what I am trying to solve...so I will paste it here as well.
The comment, "This part doesn't work", was meant to direct the attention away from the first call to OnPlaceData() to the lines of code that were causing problems. All I want to happen is for the Autoplane() member that is defined in the view part of the MDI (I think there are three parts in MDI, the view, the doc, and the app) to be successfully called from a button I placed on a different dialog box. To do this I tried to create an pointer of the view class type and call the member. It compiles fine, but in runtime the program crashes.
[/modified]
modified 30-Nov-11 14:24pm.
|
|
|
|
|
You can't just declare a pointer to <code>CWinSTMView</code> and then call a method on it. Either use <code>new</code> or just declare the class: <code>CWinSTMView View</code> then call <code>View.OnImageAutoPlate()</code>
|
|
|
|
|
My pointer to nothing doesn't work...
|
|
|
|
|
I tried what you suggested, but I get the error message that CWinSTMView::CWinSTMView() is inaccessible.
|
|
|
|
|
When do you get this error? Is the constructor of this view public?
|
|
|
|
|
No, the constructor is not public. It is protected and I was unsure if just changing it to public was the best way to solve the problem. So, I thought I would ask if it was good programming practice in my efforts to understand MFC programming.
|
|
|
|
|
If it's protected, it's probably not meant to be accessed that way... see my other post. Usually multi-view documents in MFC have to be initialized through MFC methods/macros.
|
|
|
|
|
By the way, if the view already exists, trying to do what Jonathan suggests isn't the proper thing to do... if it exists, then you need to either use the framework to pass the message to the view or get a hold of the pointer to the view itself and do a SendMessage() to it.
|
|
|
|
|
AndrewG1231 wrote:
What does that mean? We cannot see your PC screen so have no idea i) what is supposed to happen, or ii) what actually happens.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
I'm sorry about being vague...I am really trying my best with all my posts to be as descriptive as possible, but based on the responses I must continue to improve in this aspect. The comment was meant to direct the attention away from the first call to OnPlaceData() to the lines of code that was causing problems. All I wanted to happen is for the Autoplane() member that is defined in the view part of the MDI (I think there are three parts in MDI, the view, the doc, and the app) to be successfully called from a button I placed on a different dialog box. To do this I tried to create an pointer of the view class type and call the member. It compiles fine, but in runtime the program crashes.
|
|
|
|
|
AndrewG1231 wrote: It compiles fine, but in runtime the program crashes.
Because you create the variable but never initialise it:
CWinSTMView *pView; pView->OnImageAutoPlane();
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
These two statements don't do what you expect
CWinSTMView *pView;
pView->OnImageAutoPlane();
All it does is declare that pView is a pointer to "something" but you don't actually initialize it to point to anything. Then you try to use it.
I assume that the CWinSTMView object was instantiated somewhere else and you are trying to access it. You need to find that object and initialize pView to point to it. How you find that object is your problem as the amount of code posted is not enough for me to guess at it.
|
|
|
|
|
Thanks, I will look for where it is instantiated
|
|
|
|
|
Have you tried something like:
AfxGetApp()->GetMainWnd()->GetActiveView()->OnImageAutoPlane();
AfxGetMainWnd()->GetActiveView()->OnImageAutoPlane();
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
I have not, but when I use your suggestion:
class "Cwnd" has no member "GetActiveView"
|
|
|
|
|
Which is why I added the "casting not provided" comment. As I don't know the name of your frame/doc/view classes, you'll need to cast some of those function calls to your specific situation.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
I was able to solve the problem after I did some research on the MSDN site about the suggestions of sending messages and GetActiveView(). :
OnPlaceData();
CMDIFrameWnd *pFrame =
(CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild =
(CMDIChildWnd *) pFrame->GetActiveFrame();
CWinSTMView *pView = (CWinSTMView *) pChild->GetActiveView();
pView->OnImageAutoPlane(); Now my pointer points to something and I was able to access that member (and others that I wanted to use as well). Thanks for the help!
|
|
|
|