bluehell555
Badges: 0
#1
Report Thread starter 11 years ago
#1
Is there anyway to have C++ reading from access, and saving data to access, and how would i go about doing this???, as well as, is there a way to print of a report created in access
0
reply
cascadingstylez
Badges: 18
Rep:
?
#2
Report 11 years ago
#2
http://www.google.co.uk/search?hl=en...access&spell=1

I'd personally uses a better database.
0
reply
Mathmoid
Badges: 0
Rep:
?
#3
Report 11 years ago
#3
For accessing Access data you can use one of Microsoft's data access interfaces, the main ones being ADO, OLEDB, ODBC and DAO. I'd probably go for ODBC as it is a more C interface and closer to the SQL CLI standard, but ADO is probably easier if you're happy depending on COM, and DAO might be worth a look too.

http://msdn2.microsoft.com/en-gb/lib...14(VS.85).aspx

If you need to access Access reports as opposed to simply access data, you're probably going to have to investigate MS Access' automation interface so it'll be more COM and probably quite messy from C++.

http://msdn2.microsoft.com/en-us/library/bb149076.aspx
0
reply
bluehell555
Badges: 0
#4
Report Thread starter 11 years ago
#4
maybe it's best if i explain what i am doing / wanting to do.

I am making a magazine inventory system, so it stores the name, publisher, etc of magazines, up to 1000.

I want it so when the user enters a magazine in the program it will then store to Access database using C++ as the in between.

Also if i can get that working, is it possible to print out a report made in access using C++
0
reply
Mathmoid
Badges: 0
Rep:
?
#5
Report 11 years ago
#5
Is storage in Access a requirement? If so, I'm not sure that I'd use C++. From what it sounds like you are not doing anything that cannot be accomplished in Access itself so using C++ seems like needless complexity. I can't immediately see anything that can't be accomplished with Access forms, but if there is, VBA would probably be any easier way to add it.

On the other hand, if you just need a persistence mechanism for some custom C++, as mentioned previously, there are easier and better ones than Access.
0
reply
bluehell555
Badges: 0
#6
Report Thread starter 11 years ago
#6
It has to be made in C++, and have file handling, and it just seems stupid to store this a .txt file, i was hoping i could do some database handling
0
reply
Mathmoid
Badges: 0
Rep:
?
#7
Report 11 years ago
#7
It sounds like a warped set of requirements but if you *have* to have file handling, but you do database handling instead then you don't meet the requirements. Databases don't have to be stored in files, so if you're abstracted from the file system layer by a database interface then you don't have file handling in your programming.

It doesn't look like you have a complex data set to manage, as long as you don't have any overly restrictive concurrency requirements, I think you'll find that a simple file-based persistence mechanism will be a lot cheaper to implement.
0
reply
bluehell555
Badges: 0
#8
Report Thread starter 11 years ago
#8
database system does meet the requirements, i just wanna know how to store into a database, and read from a database
0
reply
PieMaster
Badges: 11
Rep:
?
#9
Report 11 years ago
#9
If youre on Windows: http://www.microsoft.com/sql/edition...s/default.mspx
0
reply
Mathmoid
Badges: 0
Rep:
?
#10
Report 11 years ago
#10
I don't understand. What did you mean by "It has to be made in C++, and have file handling" then?

If you want to interact with a database from C++ then assuming you're not going to implement the database yourself (i.e. you're not doing the raw file handling) then you'll need to use a database API. I gave you a link to a whole lot of possiblities from Microsoft as you seemed to need Access at the time, but if you're now considering other databases such as MySQL, Oracle, postgres then these have there own APIs and google is your friend.
0
reply
bluehell555
Badges: 0
#11
Report Thread starter 11 years ago
#11
how would i use C++ with SQL server, and would i be right in assuming i can't print reports with this
0
reply
bluehell555
Badges: 0
#12
Report Thread starter 11 years ago
#12
cause i don't think it looks very nice, and there will be extra function to search and edit, and it is much easier to do with a database.

I just need some pointers
0
reply
Mathmoid
Badges: 0
Rep:
?
#13
Report 11 years ago
#13
If you want to access SQL Server from C++ I'd recommend ODBC. It's not too hard as it's a C based API and gives you access to most things you'll need.

As far as printing reports, that's not really the job of a database. Do you mean just printing text to screen, or "pretty printing" in a pdf / send to printers type of printing? If the former, just regular C++ streams output would work, if the later you'll probably want to use some sort of library, or possibly output something that can be postprocessed by another tool. For example, you could format html that could be printed by a browser, or you could format tex or latex that can be turned into a pdf an printed by a pdf reading tool.
0
reply
bluehell555
Badges: 0
#14
Report Thread starter 11 years ago
#14
printing is not a problem atm, i just want to focus on saving into a database
0
reply
tommorris
Badges: 2
Rep:
?
#15
Report 11 years ago
#15
If you are doing only a thousand records, try sqlite. It's open source and lightweight. And there's a sqlite API for C and C++ available.
0
reply
bluehell555
Badges: 0
#16
Report Thread starter 11 years ago
#16
could you guys please give me some hints on how i would write to a database instead of suggesting databases???
0
reply
gregmantis
Badges: 0
Rep:
?
#17
Report 11 years ago
#17
This might be more suitable than access depending on your requirements.

http://www.sqlite.org/

For a small number of records like you are suggesting, I'd rather just implement something from scratch though.
0
reply
bluehell555
Badges: 0
#18
Report Thread starter 11 years ago
#18
again abit more assistance would be nice, our lecturer is abit crap so i don't know how to do database handling with C++
0
reply
Mathmoid
Badges: 0
Rep:
?
#19
Report 11 years ago
#19
(Original post by bluehell555)
could you guys please give me some hints on how i would write to a database instead of suggesting databases???
How you do it depends on which database you are using. We don't know which database you've chosen, but you originally suggested Access. I pointed you at the Microsoft documentation for a range of different APIs as one of these is likely to be what you'd have to use. Without any more specific questions, or at least an indication of which API you are going to use it's difficult for anyone to suggest how you are going to do this. Have you looked at, for instance, the ADO API, to see if it offers you the functionality that you think you'd need?
0
reply
bluehell555
Badges: 0
#20
Report Thread starter 11 years ago
#20
(Original post by Mathmoid)
How you do it depends on which database you are using. We don't know which database you've chosen, but you originally suggested Access. I pointed you at the Microsoft documentation for a range of different APIs as one of these is likely to be what you'd have to use. Without any more specific questions, or at least an indication of which API you are going to use it's difficult for anyone to suggest how you are going to do this. Have you looked at, for instance, the ADO API, to see if it offers you the functionality that you think you'd need?
TBH i didn't even understand it, i'm a visual basic guy, and been thrown at the deep end with C++ without being taught it
0
reply
X

Quick Reply

Attached files
Write a reply...
Reply
new posts
Back
to top
Latest
My Feed

See more of what you like on
The Student Room

You can personalise what you see on TSR. Tell us a little about yourself to get started.

Personalise

Would you turn to a teacher if you were being bullied?

Yes (102)
24%
No (323)
76%

Watched Threads

View All