第一个例子:
#include "stdafx.h"
#include <iostream>
#include <string>
#include "SQLAPI.h"
using namespace std;
#pragma comment(lib,"sqlapi.lib")
int main()
{
SAConnection conn;//连接对象
try{
conn.Connect("test","root","root",SA_MySQL_Client);
SACommand cmd(&conn,
"select 'aaa' as fstr union select 'bbb' ");
cmd.Execute();
while(cmd.FetchNext()){
SAString s=cmd["fstr"];
cout<<s.GetBuffer(0)<<endl;
}
}catch(SAException & e){
cout<<"exceptin"<<endl;
cout<<e.ErrText()<<endl;
}