0

我正在使用 c++ builder XE6 和 Microsoft SQL Server 2012,并且我已连接到我的数据库中,但是当我尝试选择一列时出现错误,这是我的代码

 int Recuperer_Num_Verssioning_Sqlserver ()
{
TSQLConnection   *co = new TSQLConnection(NULL);
Base_SQLServer *sqls = new Base_SQLServer()  ;
bool bl = sqls->Connecter(co);
String tn =   ":BASE.:DBO.T_SOCIETE" ;
String col = "NUM_1" ;
String sqlstring = "SELECT " + col + " FROM " + tn +"";
int num ;

if (bl)
   {
        TSQLQuery *req = new TSQLQuery(NULL) ;
        req->SQLConnection = co ;
        req->SQL->Clear() ;
        req->SQL->Add(sqlstring) ;
        req->Open() ;
       //   req-> ExecSQL() ;
        if (!req ->Eof)
                {
                 num =  (int) req ->Fields->Fields[0]->AsCurrency ;

                }
                delete req ;     
                delete co ;
                delete sqls ;

                return num ;

   }

return -1 ; // echec lors du retour du numéro de verssionig .

}

打开后我收到此错误 SQL 错误代码:1087

4

0 回答 0