I’m trying to connect SQL with ADO.NET (C++
) in MFA project. I have created SQL with SQL server (int,text,int,int,int,tex,text)
But I have problem with ^
using.
In init I have:
String ^str;
SqlConnection^ myConn = gcnew SqlConnection
("Server=localhost;Integrated security=SSPI;database=master");
str = "CREATE DATABASE MyDatabase ON PRIMARY "
"(NAME = MyDatabase_Data, "
"FILENAME = 'C:\MyDatabaseData.mdf', "
"SIZE = 2MB, MAXSIZE = 10MB, FILEGROWTH = 10%)"
"LOG ON (NAME = MyDatabase_Log, "
"FILENAME = 'C:\MyDatabaseLog.ldf', "
"SIZE = 1MB, "
"MAXSIZE = 5MB, "
"FILEGROWTH = 10%)";
And problem I have in this part:
if (myConn)->State == ConnectionState::Open)
{
myConn->Close();
}
But also question how I can read data from table?