#include "stdafx.h"
using namespace System;
using namespace System::Data;
using namespace System::Data::OleDb;
void main()
{
OleDbConnection^ myConnection = nullptr;
myConnection = gcnew OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Music.mdb");
myConnection->Open();
OleDbCommand^ MyCommand = gcnew OleDbCommand("SELECT COUNT(*) FROM Music WHERE Genre=@Genre",myConnection);
OleDbParameter^ parameter = gcnew OleDbParameter("@Genre",OleDbType::Char);
parameter->Direction = ParameterDirection::Input;
parameter->Value = "Techno/Classical";
MyCommand->Parameters->Add(parameter);
Object^ Count = MyCommand->ExecuteScalar();
Console::WriteLine("Count = {0}", Count);
myConnection->Close();
}
|