Click here to Skip to main content
15,896,153 members
Please Sign up or sign in to vote.
2.00/5 (4 votes)
See more:
i have worked on c++, but i never used database with c++. Can anyone can tell me how to do that. any link,sample code etc. will be appreciated.
Posted
Comments
[no name] 6-Sep-12 14:44pm    
Based on your totally vague non-question http://www.bing.com/search?q=%22C%2B%2B%22+database&FORM=SAWRES&src=IE-SearchBox&adlt=strict

To add to what was said in Solution 1...

Install SQL Server on your local system. It should install as the SQLExpress version. This is a nearly full featured version of SQL Server. It's been tuned for personal use but supports most of the SQL Features and probably all of them that you would need. Be sure and install SQL Management Studio. You'll want that.

Create your console application with MFC support.

Use the class wizard to create your database classes/records from existing tables in the database.

Microsoft has announced that SQl Server OLE DB is being phased out in favor of ODBC. Avoid that unless you have a requirement to use it.

The CRecordSet based classes are easy to work with. You might start with those.
 
Share this answer
 
Comments
footballpardeep 7-Sep-12 12:42pm    
thanks, I am trying
Mohibur Rashid 7-Sep-12 18:29pm    
yep, it would work
As wes Aday said, your question is vague. Why vague?


Well, you said you want to use c++. but what is missing?
I will say, your database. What database do you want to use? There is few popular database, but two common database I can recall
1. MySQL
2. postgresql.

Both of them are good with strong features. I suggested them because, both of them are free.

So, pick your database also pick your compiler. go to google.com and start searching with the name. You will get your way out............
 
Share this answer
 
Comments
footballpardeep 7-Sep-12 3:21am    
Thanks for reply.
Let me explain one more time.
1)I want to develop a c++ console application( you can say employee record application, where user can save record to database, and can retrive it later.)
2) As i am familiar with microsoft sql server 2008, so i would like to prefer sql.
3) i searched on google or read some books but i don't found anything useful about using database with c++.
4)Any tutorial may be good or any sample.
Mohibur Rashid 7-Sep-12 3:29am    
Some people feel insulted when I tell them to start with google. I will also ask you, did you spend some time on google? not with stars name with "sql server 2008 c++ api" or anything else? I am not sure though. well, I searched for you, which I should not do, and found this link http://www.tidytutorials.com/2009/08/connecting-to-sql-server-using-c-odbc.html. I dont have special time for anyone. so you will have to search by yourself and there is lots of good example out there
footballpardeep 7-Sep-12 3:41am    
thanks, i will search and tell me one more thing, i am using Turbo c++ compiler, that will work for that or i will have to download some other compiler.
Mohibur Rashid 7-Sep-12 6:34am    
Probably version 3.0. No it wont work. Download express version of visual studio
JackDingler 7-Sep-12 14:06pm    
Right. It won't work. That compiler and it's libraries are very outdated.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900