#include <iostream>
#include <string>
using namespace std;
class w {
public:
void InsertRow(String* myConnection)
{
// If the connection string is null, use a default.
if (myConnection->Equals(S""))
{
myConnection = S"DRIVER= {SQL Server};SERVER=MyServer;Trusted_connection=yes;DATABASE=idb;";
}
OdbcConnection* myConn = new OdbcConnection(myConnection);
String* myInsertQuery = S"INSERT INTO test (id)";
OdbcCommand* myOdbcCommand = new OdbcCommand(myInsertQuery);
myOdbcCommand->Connection = myConn;
myConn->Open();
myOdbcCommand->ExecuteNonQuery();
myOdbcCommand->Connection->Close();
}
};
hai i m trying to connect visual studio C++ to mysql, i m using odbc method... i have connect the database to the visual studio, but i dnt know the code need to connect in the c++ ( example for vb.net we will use the dim.... database name all and establish connection) i need the same thing in c++,
i have try this code ealier post above but its not working>..