|
I'm an intermediate type C++ programmer, with little experience in MFC and no experience integrating C++ applications with databases; though I have done this in a Web Environment using PHP and mySQL.
I'm wondering where to start! I've been looking for a good manual as a start place, but can't seem to find any.
I don't know what COM/ADO/OLE/OLE DB are, though I keep seeing these terms everywhere - I think they may be some kind of drivers for interfacing with a database?
Let me explain what I'm trying to learn how to do, very quickly:
I have users at their home PC's, all with the same ACCESS database, containing completely different data. These databases are updated very quickly, with thousands to tens of thousands of new records per day.
I want to build an application which can query/update these databases, and synchronize them with eachother. I'm thinking that the synchronization will be difficult and probably involve the use of MS SQL Server 2003.
So my problem is this: I'm not quite sure where to start. I've started by creating lots of applications in MFC, following examples and have gotten myself a bit more familiar with this, but I can't seem to find any tutorials on interfacing with an ACCESS database. ACCESS of course supports SQL.
Anyone have any suggestions?
Thank you.
|
|
|
|
|
I have no link for a manual but I can share some of my experience with this topic. I have been writing database applications in VC6 since it has been on the market. I started out using DAO but after running into several problems related to limitations in DAO, I decided to convert to ADO. I believe this was 4 to 5 years ago and at this time there was no C++ docs at all everything was in VB which made things a little difficult because of the differences between the languages. But now I know MSFT does have docs for VC++ also. I was still using access as a database but then I found the need to use stored procedures and other things that access did not have so I moved on to use MSDE as my database. If you are not familiar with MSDE it is a free version of SQL server that has a few limitations (2GB of data max and 10 simultaneous connections). One thing with MSDE is that the ADO and SQL is exactly the same as SQL server so if you need to scale up it will not be difficult at all.
Below is a link to a class that will make ADO programming soo much simpler:
http://www.codeproject.com/database/caaadoclass1.asp[^]
John
|
|
|
|
|
So I shouldn't bother learning DAO, I should start with ADO. I'm not sure what ADO is, or how it relates to the .NET framework.
Any links to beginner articles on this?
I'm not familiar with MSDE, but I just looked up the website, started the download, and I'm sure it'll be easy enough to figure out. Just another SQL server. 2GB of data and 10 simultaneous connections seems like it should handle what I'm doing.
I checked out your link, looks like a .lib file for making my life easier using ADO, right?
I've never used a .lib file before - any links on basic information about using libraries?
Sorry to trouble you so much. Your previous is help is already appreciated.
|
|
|
|
|
I'm sorry I have to be very short with my answers. I am very busy at the moment...
budidharma wrote:
So I shouldn't bother learning DAO, I should start with ADO.
Yes. I believe ADO is your best bet of all the ways to use databases with VC++. COM/ OLE-DB ... are lower level / harder to use than ADO.
budidharma wrote:
2GB of data and 10 simultaneous connections seems like it should handle what I'm doing.
That was enough for all the tasks I needed.
Here is a link to a tool that I find very helpfull with my MSDE databases: http://gpoulose.home.att.net/[^]
I will try to help with your other questions later today if I can.
John
|
|
|
|
|
Another quick question: I assume ADO allows you to interface with an SQL server. What if the database I want to query isn't running on a server? Can I use ADO to load an access database file just sitting in it's folder, and perform SQL queries against it?
|
|
|
|
|
Yes. You do this with the connection string.
Below is the example of this I took from the link I gave you:
CADODatabase* pAdoDb = new CADODatabase();
CString strConnection = _T("");
strConnection = _T("Provider=Microsoft.Jet.OLEDB.4.0;"
"Data Source=C:\\VCProjects\\ADO\\Test\\dbTest.mdb");
pAdoDb->SetConnectionString(strConnection);
John
|
|
|
|
|
Thank you. That's very helpful.
I'm using Microsoft Visual Studio 2003.NET. Does ADO come with this IDE, or is ADO something I need to install separately. I found a beginning ADO tutorial in the articles, and attempted to start it, by inserting the following code into a console project:
#import "msado15.dll" \
no_namespace \
rename( "EOF", "adoEOF" )
The tutorial I'm using is here: http://www.codeproject.com/database/simpleado.asp
And attempted to compile, with the following error:
c:\XXX\My Documents\Visual Studio Projects\MS Database\stdafx.h(14) : fatal error C1083: Cannot open type library file: 'msado15.dll': No such file or directory
I'm assuming this means that ADO is either not installed, or configured correctly. I do not know how to check if it is installed. I went to the MS Site on ADO:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdconreferencingadolibrariesinvc.asp
And it gave me the same instructions, did not say anything about installing ADO, so I assume it should be installed?
Sorry, like I said this is my first time trying to work with a database, and I've never touched ADO before.
Thanks for bearing with me.
|
|
|
|
|
budidharma wrote:
c:\XXX\My Documents\Visual Studio Projects\MS Database\stdafx.h(14) : fatal error C1083: Cannot open type library file: 'msado15.dll': No such file or directory
Try this:
#import "C:\program files\common files\system\ado\msado15.dll" \
no_namespace \
rename( "EOF", "adoEOF" )
budidharma wrote:
Does ADO come with this IDE,
No ADO/MSDE does not have an IDE. I use ACCESS and AdoQuery tool (link below) to work with my MSDE databases.
http://gpoulose.home.att.net/[^]
John
|
|
|
|
|
Ah. Apparently it wasn't configured correctly. He assumed I had a system variable set to point to the correct direction of ado.
It works now, thank you very much.
Does ADO come with this IDE - I didn't mean, does this IDE have an ADO based query tool, I was referring to the msado15.dll lib.
Apparently it did come.
I'll check out that ADOQuery tool as well. Thank you very much for getting me started.
|
|
|
|
|
I am developing a GUI application using winforms in vc++ .net.
I have an event (onButtonClick) which reads a matrix from file input from user.
I want to access this matrix for couple of other event including displayGraph_Click. Can anyone send me info on how I should declare this float data matrix
Sunit
|
|
|
|
|
If I do
int fd= open(myfile, O_RDONLY);
and its successful, then close it immediately, it crashes on linux
close(fd);
This doesnt happen on windows. ???
Thanks
sb
|
|
|
|
|
Hi
I need random number generator.
In my case, RN generator must to generate random number every second.
How can i decide it?
If you have any suggestion, help me pls
Help me
|
|
|
|
|
Hi,
If you are using a windows app, you can use a WM_TIMER callback. Other than that you can create a thread that sleeps for a second generates a random number, etc.
regards,
Rich
"Programming today is a race between software engineers striving to build bigger and
better idiot-proof programs, and the Universe trying to produce bigger and better idiots.
So far the Universe is winning." -- Rich Cook
|
|
|
|
|
My problem is:
when i define like this
typedef float Sequence[];
i dont know how to declare an array with Sequence.
Ex:if i declare
Sequence a[10];
it doesn't work.
Can you help me???
Thank in anticipation!!!
|
|
|
|
|
I doubt that you can. Why would you do this ? Why obsfucate your code with not just typedefs, but a typedef that hides the fact that you're dealing with an array ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi,
Typedefs are like fancy text replacements, so you just coded:
float a[10][]
Hence the compiler does not know what the second index is. You are creating a double pointer list.
regards,
Rich
"Programming today is a race between software engineers striving to build bigger and
better idiot-proof programs, and the Universe trying to produce bigger and better idiots.
So far the Universe is winning." -- Rich Cook
|
|
|
|
|
use:
typedef float Sequence;
Sequence a[10];
Bye and c ya!
|
|
|
|
|
No MFC. The word makes my head ache more than ever. I looked all over the place for someone who knows the answer... So far I have reached this much... I have a status bar in a MDI application that blinks like crazy when I have 1+ child on the screen. When I move the child over the status bar it tears.... I heard that you need a back buffer? But how to you make a backbuffer out of a HWND. What does a HDC have to do with a HWND. Please someone help me with a sample...
Heres a my code
<br />
<br />
Kbar = CreateWindowEx(0, STATUSCLASSNAME, NULL,<br />
WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP, 0, 0, 0, 0,<br />
KhWnd, (HMENU)IDC_MAIN_STATUS, GetModuleHandle(NULL), NULL);<br />
<br />
in WM_SIZE I have this.<br />
<br />
void OnMainSize(LPARAM lParam)<br />
{<br />
SendMessage(Kbar, WM_SIZE, 0, 0);<br />
}<br />
Please help me...
|
|
|
|
|
What does the Kbar WM_SIZE code do? When I have a child window linked to a parent window's size, I just size the child with a SetWindowPos in real time with the parent.
|
|
|
|
|
hai..
i encountered a problem on the traffic light simulation project..
how can i change the colour of traffic light and using what item..
also how can i make the car moving in the required time..
so they dont crash on each other..i used 4 junction.
can anyone help me please..
im running out of time..
|
|
|
|
|
You can't possibly be using MFC AND VB.NET, at least I can't imagine why you would, given that VB.NET is good for nothing more than making a UI, and MFC is a UI library in C++. Either way, you need to do your own homework, and ask questions after you've tried to do it yourself, and have some specific problem you need help with.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi,
Let me get this right, you need to control 4 traffic lights and cars with the roads connected in a square??
The simple thing to do is just create a traffic light and car classes and create methods that would allow you to move the cars and change the lights of the traffic signals. Then in your main algo set the traffic lights and create a list of cars that are waiting on each light.
regards,
Rich
"Programming today is a race between software engineers striving to build bigger and
better idiot-proof programs, and the Universe trying to produce bigger and better idiots.
So far the Universe is winning." -- Rich Cook
|
|
|
|
|
hello...
i encountered a problem on my project..
my project is a game. kinda like a jumble word..
is like arrange from a various word to make a sentence..
so how to detect if the answer is right
and also how to drag the to words to make the sentence.
please..
can anyone outhere help me.
im running out of time..please i need anyone to help me
please....please
|
|
|
|
|
Hi,
Your specification does not make a lot of sense. From what I can get out of this is that you are to select words, move them around to make a sentance and decide if the sentance is correct?? Please clarify.
If the above is correct, then you would need some sort of gramma engine, unless you know all the sentances that can be made with the words.
regards,
Rich
"Programming today is a race between software engineers striving to build bigger and
better idiot-proof programs, and the Universe trying to produce bigger and better idiots.
So far the Universe is winning." -- Rich Cook
|
|
|
|
|
hello...
i encountered a problem on my project..
my project is a game. kinda like a jumble word..
is like arrange from a various word to make a sentence..
so how to detect if the answer is right
and also how to drag the to words to make the sentence.
please..
can anyone outhere help me.
|
|
|
|