SOL9 Sample: ADOConnectionProperties
|
1 Screenshot
2 Source code
/*
* ADOConnectionProperties.cpp
* Copyright (c) 2015 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED.
*/
// SOL9
// 2009/05/15
// Run this program on the MS-DOS command prompt in the following way:
//
// C:>\usr\src\console_app\sql\ADOConnectionProperties.exe Connection.properties
// Please modify the Connection.properties file to fit your SQL Server environment.
//
#include <sol/sql/ADOConnectionProperties.h>
#include <sol/COMError.h>
#include <sol/Exception.h>
void _tmain(int argc, TCHAR** argv)
{
const TCHAR* propFile = NULL;
if (argc == 2) {
if (GetFileAttributes(argv[1]) != 0xffffffff) {
propFile = argv[1];
} else {
_tprintf(_T("Not found a file %s\n"), argv[1]);
return;
}
} else {
printf("Usage: ADOConectionProperties.exe Connection.properties\n");
return;
}
try {
ADOConnectionProperties props;
if (propFile) {
props.load(propFile);
}
String constring;
props.getString(constring);
_tprintf(_T("ConnectionString:\"%s\"\n"), (const TCHAR*)constring);
_tprintf(_T("\nConnectionProperite:\n"));
props.dump();
} catch(HRESULT hr){
printf("Exception hr=%x\n", hr);
} catch( _com_error &e) {
COMError error(e);
error.dump();
} catch(Exception& ex){
ex.dump();
} catch(...) {
printf("Exception:Unknown\n");
}
}
Last modified: 2 May 2016
Copyright (c) 2016 Antillia.com ALL RIGHTS RESERVED.