How do I add Mysql.data.dll into uwp with c++? - c++

I have been to try to use Mysql with c++ in UWP for 2 days...but I could not do so.
I already installed Mysql.data and Mysql.ConnectorNet.Data through Nuget.
However when I tried to use Mysql obejct, I couldn't find anything. Intelligence does not work too so I tried to add Mysql.data.dll directly, but I couldn't do too. I just got a error message. It said that "could not add a reference to "my path" as it is not of a type or version current proejct can use."
Does anyone know how to solve it?

Mysql doesn't provide a dll which can be directly used by C++/CX in its official site. The dll you mentioned "Mysql.data.dll" is actually a Dll for winrt .net which can not be directly used in C++/CX.
See MSDN docs:How to: Use Existing C++ Code in a Universal Windows Platform App
You will find this:"Do not add a reference in the References node in Solution Explorer. That mechanism only works for Windows Runtime Components."
So actually you can test by create a new simple Windows Runtime Component to see what it is.
Possible ways to start are
Read the above msdn doc and use native C++ mysql library which is located under C:\Program Files\MySQL\MySQL Connector C++ 1.1.9\lib\opt(After installed the native C++ Connector you can find it). ( I haven't worked out when using static library yet.)
Or Directly use the code from it's github to create a C++ winrt version dll.
As this may need lots of time when investigating I think it's better for you to think about using some exist database technology. Like UWP suggested sqlite database.

Related

How to install npgsql for c++ in Visual Studio 2017

sorry if this is too simple to be of help to most people.
This is the first time I have done anything remotely like this and it appears that my problem is too unadvanced to be covered in any documentation.
I am trying to connect a c++ project in Visual Studio 2017 to a PostgreSQL database.
Just to be clear, I know how to run pgAdmin/host databases, code in C++, and I think I could handle the npgsql syntax if I got it working.
However, I've never used .NET (although 4.5 is on my computer).
Here's what I am doing:
I start an empty project for C++ in Visual Studio 2017.
I open nuget manager and search npgsql, but my project is pointing to native,v0.0 instead of a .NET framework.
So I target v4.5 in the .NET framework property, but that doesn't change anything.
Could someone please tell if what I am trying to do is possible?
Should I be using a different project other than empty project?
Does this need to be some kind of web application?
If it is possible I'd love any advice on how to do it.
If you are writing a native c++ program it is very unlikely you want to bring in a .net assembly. If you want to connect to a pg database I would suggest instead that you use the odbc driver (https://odbc.postgresql.org/) or perhaps there is some library available as part of PG, but using a .net assembly will require a great deal of unnecessary interop work.

How to use C++ (in Linux) to connect MYSQL database (in WINDOWS)

I built a database of MYSQL in windows environment, I found a lot examples C++ API for MYSQL in visual studio environment. But I am not sure that if I write a program to test the C++ API by using gcc or other tools in LINUX environment (just compile and run the program, without the platform like eclipse). Because in visual studio, I need to add some lib and dll for MYSQL. Shall I need to write a configuration file? How can I do this, thanks a lot!
I want to make it more clear. The database is built in WINDOWS, I want to run my c++program in Linux. So how to compile them with some lib required by MYSQL. And is there something different when I am not in visual studio?
MySQL ships with C++ bindings, available in cppconn/* and mysql_connection.h in your include path. You will need Boost (at least shared_ptr and variant).
Check out the documentation for examples and the reference.

Best way to create a standalone-exe (Forms) (C++)

I have to create an application for testing that is relatively simple. If a user plugs in a device into a USB (hid library), the form will say "Pass". If no device is detected, it will say "Fail".
I want to create the app to run on WinXP+. It must be a forms application as it needs to be visual and have colors. The biggest requirement for me is that it must be stand-alone (a user just double clicks, the file and it opens, no installation). I need to avoid installing any extra .dll files and want to avoid the .net framework all together. It has to be written in C++.
So my question is, what are my options? I am new to Forms applications and the only forms application I have written required the .net framework.
From my research, Visual C++ seems out of the question as it requires .net for Forms apps. What about Turbo C++ by Borland? It seems outdated, but can it do the job?
I would suggest Borland C++ Builder 5 or 6. Visual C++ lacks the functionality to create C++ form apps, if we dismiss MFC
I'd say Visual C++ would probably still be your best option. A standard simple Win32 C/C++ program using only the native API will should suite your needs just fine. If you're targeting XP+, then the only dependency would be "msvcrt.dll" which is included with Windows by default.
Edit: This article on MSDN should get you started in the right direction.
What you're talking about is C++/CLI, it's microsoft's dialect of C++ that requires a .Net framework. Please distinguish it from real (native) C++, which can be used to create what you want to. Visual C++ is perfectly fine, just make sure you don't create a .Net project.
Forms are a .NET library. It's not Windows or anything like that, you can use the native GUI libraries in Win32 with no problem or any native wrapping of them. You can implement this in native C++ easily in Visual Studio.
If you're looking to create the application in a rapid fashion (i.e. stock UI components that you can drag and drop onto forms), my experience is that Embarcardero C++ Builder effectively solves that problem space.
I like Visual C++ but it's not a great environment for rapidly creating forms based applications. I want to emphasize that I'm referring to Rapid Application Development (RAD) tools. There are plenty of great C++ IDEs and libraries for creating forms based applications and all of them should be able to create standalone exes.
Here is a list of related questions that might help in your decision:
https://stackoverflow.com/q/1754020/4916
https://stackoverflow.com/q/93326/4916
Best C++ IDE or Editor for Windows

QrCode C/C++ API For Windows

I have looked after, without luck, a free C/C++ API for Windows that can be used in a project I am about to start. There are libraries for Java and C# but the fact is there is no one for C/C++. I need an API that can be integrated in a vs project and we cannot use libraries that run in servers ( as CGI scripts or whatever ). Does anyone know this type of API?
if you want to generate QRcodes have a look at libqrencode it works with cygwin on windows (not sure about VS).
If you want to decode QRcodes have a look at zxing

Excel files and C++

How i can read\export data within a C++ application to Excel files? I was found the xlslib project, but it only compiles with MingW on Windows. My target platform is windows (MVS2008)
You can try this commercial library http://www.libxl.com, it works with Visual Studio 2008 and doesn't require Microsoft Excel.
If you're stuck with unmanaged C++ and need to communicate directly with Excel you'll need the COM automation interfaces. See the MSDN article link text
If you want the expressive power of the new managed interop, I think you may need to wrap your C++ code in an interop dll.
On windows, you can also give a try to ExcelFormat lib.
http://www.codeproject.com/Articles/42504/ExcelFormat-Library
It doesn't require Excel installed, and it's very easy to use.