0

I'm developing in C++ to which I want to add a SQL database and connect it with ADO.NET. I need to add int, string, string, string, string double, int, int to the database. And upon request, this data must be received.

I've tried to find examples but I can't. Maybe someone can add a link with a code example of how to write with ADO.NET to a SQL database and how to read the information?

5
  • what's wrong with just coding it in C# ??? if you plan to run this on any platform other than windows you will have to write it in C# Commented Apr 28, 2024 at 17:52
  • @AhmedAEK All project is written on C++, I can not change it. Commented Apr 29, 2024 at 6:55
  • Are you ever planning on running it on any platform other than windows ? Your next choice will make it impossible to migrate so you need to specify that Commented Apr 29, 2024 at 6:59
  • @AhmedAEK only windows. Commented Apr 29, 2024 at 13:22
  • The best option in terms of ease of programming is to expose ADO.net through a COM Object written in C# then consume it in C++, Biggest problem is loading the Dotnet framework runtime in C++, which is easily done by COM under the hood, i think C++\CLI can replace C# buy i don't know if you can write COM components in C++\CLI Commented Apr 29, 2024 at 13:46

1 Answer 1

1

You will need to use the .NET implementation of C++, commonly known as C++/CLI. See .NET programming with C++/CLI

Sign up to request clarification or add additional context in comments.

2 Comments

Hello! Maybe you know how I can Add .NET to MFC project?
Sorry, I have never tried it, as it is so much easier to use C#.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.