1,178
社区成员
发帖
与我相关
我的任务
分享
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
#include <SqlExpr.hpp>
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
TSQLConnection *SQLConnection = NULL ;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
SQLConnection = new TSQLConnection(NULL);
SQLConnection->ConnectionName = "MSSQLConnection";
SQLConnection->DriverName = "MSSQL";
SQLConnection->GetDriverFunc = "getSQLDriverMSSQL";
SQLConnection->LibraryName = "dbxmss.dll" ;
SQLConnection->VendorLib = "sqlncli10.dll";
SQLConnection->LoadParamsOnConnect = false;
SQLConnection->KeepConnection = true ;
SQLConnection->LoginPrompt = false;
SQLConnection->Params->Text =
"DriverName=MSSQL"
"\nHostName="
"\nDataBase=MyDBS"
"\nBlobSize=-1"
"\nUser_Name="
"\nPassword="
"\nErrorResourceFile="
"\nLocaleCode=0000"
"\nMSSQL TransIsolation=ReadCommited"
"\nOS Authentication=True"
"\nPrepare SQL=False"
"\nMars_Connection=False"
"\nSchemaOverride=sa.dbo"
"\n";
SQLConnection->Connected = true ; //如果將這名注釋掉,程序可以正常退出。
}
//---------------------------------------------------------------------------
__fastcall TForm1::~TForm1()
{
delete SQLConnection ;
}