_RecordsetPtr pRecSet;
pRecSet.CreateInstance(__uuidof( Recordset));
pRecSet->CursorLocation = adUseClient;
CString strSql = "select distinct cc.*,c.constraint_type
from user_cons_columns cc,user_constraints c
where c.constraint_name =cc.constraint_name and cc.table_name =upper
('app_leave_item') order by cc.position";pRecSet->Open(_bstr_t(strSql), GetApp()->GetConn(), adOpenStatic,
adLockReadOnly,adCmdText);
pRecSet->AddRef();if(!(pRecSet->BOF && pRecSet->adoEOF))
{
pRecSet->MoveFirst();
}_variant_t vTmp1;
while(!pRecSet->adoEOF)
{
vTmp1 = m_pForeignRs->GetCollect("COLUMN_NAME");//为什么这里会出错????一运动到这里
//就出现异常
//其实我想要获取特定表外键和主键的字段名称,改如何做呢?
}
{
pRecSet.CreateInstance(__uuidof( Recordset));
pRecSet->CursorLocation = adUseClient;
CString strSql = "select distinct cc.*,c.constraint_type
from user_cons_columns cc,user_constraints c
where c.constraint_name =cc.constraint_name and cc.table_name =upper
('app_leave_item') order by cc.position";pRecSet->Open(_bstr_t(strSql), GetApp()->GetConn(), adOpenStatic,
adLockReadOnly,adCmdText);
pRecSet->AddRef();if(!(pRecSet->BOF && pRecSet->adoEOF))
{
pRecSet->MoveFirst();
}_variant_t vTmp1;
while(!pRecSet->adoEOF)
{
vTmp1 = m_pForeignRs->GetCollect("COLUMN_NAME");//为什么这里会出错????一运动到这里
//就出现异常
//其实我想要获取特定表外键和主键的字段名称,改如何做呢?
}
{
解决方案 »
- 求一与count, distinct相关的view.
- 怎样禁用某一个角色
- 如何提高查询速度:有个查询晚上运行只要1分钟,但白天要1个多小时(此时并发用户50多个)?
- 左连接、更新表、插入表
- 怎样将多个不在同台服务器上的oracle数据库,里面的数个相同结构的表,保持数据同步◎◎◎◎◎◎◎◎◎◎◎
- 紧急求救:服务器突然崩溃,系统重装后我只能把*.ora文件拷出来,请问如何把*.ora文件中的数据倒入oracle中?
- 迷茫?
- select top 问题
- 大家讨论一下滥用触发器会给系统带来什么危害
- 将一个表的数据的加入到另一个表实现问题?
- 如何获得包和包中的所有参数(包括参数属性,比如游标定义)列表的sql语句。
- 请问如何在SqlLoader中装载日期型定值SYSDATE的年月日YYYYMMDD形式?急用,谢谢~
from user_cons_columns cc,user_constraints c
where c.constraint_name =cc.constraint_name and cc.table_name =upper
('app_leave_item') order by cc.position
这样可以取出来,
m_pForeignRs->GetCollect("COLUMN_NAME")是什么意思,怎么没有pRecSet了?
加条异常处理语句:
BEGIN
pRecSet->CursorLocation = adUseClient;
...
EXCEPTION
WHEN OTHERS THEN
dbms_output.putline('Error Code:'||sqlcode||' ErroMsg:'||sqlerrm);
END;
To rolandzhang():单独执行是正常的!我在plsql执行出来的结果都对了,只是在程序里面不知道怎么获取外键和主键的字段名,一获取就出错!!!
pRecSet->GetCollect("COLUMN_NAME")就是取COLUMN_NAME列的值吗?要是那样的话应该可以啊你换成select cc.COLUMN_NAME,c.constraint_type
from user_cons_columns cc,user_constraints c
where c.constraint_name =cc.constraint_name and cc.table_name =upper
('app_leave_item') order by cc.position
试试
在plsql中已经看到结果是对的了,可就是读不出来???怎么办??
我其他地方的数据都通过GetCollect("")的方式去读的,为什么就这个地方不行的?
还请指教指教指教!!!!谢谢
反正就是执行这条语句GetCollect("COLUMN_NAME")的时候出错了。
2、把COLUMN_NAME换成TABLE_NAME或其他列看看能不能查出来?
3、把select语句换成简单的查询语句(如select 1 from Dual),看看GetCollect能否取出来