Accessing a database using visual c++ and OLEDB - c++

Does anybody have an example of working with database using Visual C++ and OLEDB? What should I include on top of my code?
I have searched the internet and most examples are using C# or VB. Examples written by C++ are usually not complete.
I really appreciate your help.
Best,
Shadi.

You probably want to use ADO to do this. Writing code directly to OLE DB from C/C++ is a fair bit of work (understatement). If you google for c++ ado, there are a number of hits. The top two are this one on codeguru and one on codersource. They both look like good examples.

Related

Using JasperReports (JasperSoft Studio + JasperReports Library) with ColdFusion 9 Standard Edition

So this is my first time posting a question here. If I do it wrong, please, be gentle. :)
I'm trying to find a decent reporting solution at my company and it seems like JasperReports is one of the better (read: inexpensive) ways to go. They've got a newly revamped Eclipse-based banded report editor called JasperSoft Studio, and it looks really slick.
The problem I'm having is figuring out exactly what pieces I need in order to use this tool (or the files it creates) in my CF apps. After much Googling, I'm not really finding the answers I'm looking for... and what little information I do find is really pretty old.
Is anyone using JasperSoft Studio in combination with the JasperReports Library to do any on-the-fly PDF creation? We've come to a point on this particular application where cfdocument just isn't cutting it.
The things I know are:
CF is using a really (really, really) old version of JasperReports
under the hood to drive cfreport.
There is a way for me to override the really old version of
JasperReports so that CF will load the newest one.
Beyond that though, I'm not sure if it's just a matter of using JasperSoft Studio to create compiled JRXML files or (.jasper files, I'm not sure which) and then maybe just rename those to '.cfr' which cfreport knows how to deal with... or what?
If I look at the documentation for JasperReports Library it would seem that I need a lot more than just the JR Library and the JasperSoft Studio to make all of this work... but it's just kind of unclear to me. Because the library is so flexible and can be used from lots of different types of systems I'm having trouble figuring out what I need for my certain set of circumstances.
Is anyone out there using JasperReports in their CF applications or does anyone have any experience setting up to use JasperReports with CF?
There seems to be precious little information on this topic. :(
Also, in case it comes up (as it did in a few of the much older posts I found on the internet) ColdFusion is written in Java so I DO have access to any underlying Java Classes that I might need.

Copy specific cells from an excel document using C++

I have been looking into trying to manipulate an excel document using C++. Basically what I want to do is access an excel document and copy a specified line from that document to the windows clipboard.
I haven't found any libraries I am able to use or any commands I can use to accomplish this task. If anyone can point me to any documentation or examples that show me how to get this accomplished it would be much appreciated.
You can do so using Excel's COM object. Microsoft provides examples in all their languages, here's one in C++
http://support.microsoft.com/kb/216686
And another, more recent one also from Microsoft
http://blogs.msdn.com/b/codefx/archive/2012/03/17/sample-of-mar-17th-excel-automation-in-c-c-and-vb.aspx
It's not an easy subject, the interfaces offered are quite extensive, but it's quite popular and thus lots of examples and reading material can be found.
EDIT: do you have to do this in C++? Because you can do exactly the same thing using the same COM object but using Powershell. Have a look here
http://blogs.technet.com/b/heyscriptingguy/archive/2006/09/08/how-can-i-use-windows-powershell-to-automate-microsoft-excel.aspx

C/C++ Code Examples with HTK (Hidden Markov Toolkit)

I am trying to get started with HTK, I grabbed a copy, compiled it, grabbed the book, and all went more or less fine, little troubles here and there but nothing serious.
Now after reading the book and googling quite a while, I do not see any documentation for the essential part for me: HTKLib. Everything is described into the smallest detail for all HTK tool programs (scriptable command line interface tools) but I cannot find a single example or tutorial how to actually call the lib.
Could anyone point me into a direction?
The source code for the respective tools is included, but it would be rather cumbersome to have to extract the information for a reputable library by reading the source code... I would have expected a little more documentation , but maybe I simply overlooked it?
Any help is deeply appreciated,
Tom
edit:
I was trying to use HTK for computer vision purposes, not for NLP, and for that I required that I could link against it, and call it from within my code. Thanks for your replies.
Maybe ATK is more suitable for you. Here is the explantation from the ATK site:
"ATK is an API designed to facilitate building experimental applications for HTK. It consists of a C++ layer sitting on top of the standard HTK libraries."
In addition Microsoft Research has another research tool here for training acoustic models. This includes a set visual project for HTKlib and a set of C++ HTK wrappers, but it may only include a subset of the HTK functionality and has licence restrictions.
I have not used it but use I the language modeling toolkit. I think the main intention is to use the command line tools provided. I imagine they are very flexible tools that will enable you to build and test models. Why do you want to use the code?
Also what are you trying to do?

What are some open-source applications written in C/C++ using PostgreSQL?

I'm trying to find open source applications using PostgreSQL that are written in C/C++ so I can study them. A few open source projects using PostgreSQL are Evergreen ILS, SpamAssassin, and pgpool. However, Evergreen and SpamAssassin are written in Perl, and pgpool (written in C) is a replication tool, not a typical application. Moreover, I looked at the SQL code in Evergreen, and it is quite voluminous and complicated.
Hence, I'm looking for one or more applications using PostgreSQL, preferably those that are somewhat trivial (but not too trivial).
seen libpqxx? try asking on its mailing list (but scour their wiki first)
http://pqxx.org/development/libpqxx
pgAdmin is written using c++ using wxwidgets.
how about pgAdmin 3 ?
Also, you may find Qt4 a very easy way interact with databases programming in C++.
http://doc.trolltech.com/4.6-snapshot/sql-programming.html
Have you searched through the projects at http://pgfoundry.org ?
Two examples that are open-source:
Kexi (see kexi-project.org)
FOST4 (
http://support.felspar.com/Fost%204 )
It's pretty big, but the KDE Project's Amarok is written in C++ and can use a PgSQL backend (among several others). While it's pretty large, you may be able to find some interesting things in the database code. Since it uses a pre-defined schema (as opposed to the extremely general types of access that something like pgAdmin uses) it may have some good things to teach you. It will definitely be easier to pick apart than Evergreen, which actually has an entire middleware layer that actually does the data access through exposed services (The OpenSRF Project).

In native C++, how does one use a SqlCe .sdf database?

Is there a simple way, without .NET?
I've found some libraries but none for SqlCe 3.5. There is http://sqlcehelper.codeplex.com/ but it's far from done, since a major feature like using a password is not yet implemented. I've looked at the source and it uses OLEdb to handle the database.
The official Microsoft Northwind example (that is shipped with SQL Compact 3.1, but not with 3.5) also doesn't work, I've tried setting it up with no success.
Actually I don't have a sample working code. Was anyone able to set it up paired with a passworded .sdf?
What are the alternatives?
Thanks.
Several months ago, I compared certain database implementations for our desktop application. Using SqlCE with native C++ code is awful. If I remember right, some of native examples contains "goto" type jumps, hard to bind data and so on. If you have a choice then use SQLite.