任何人都可以帮我解决这个ADO问题吗? [英] Can anyone help me with this ADO problem?
本文介绍了任何人都可以帮我解决这个ADO问题吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
鉴于以下ADO代码段,如何检索查询结果。必须使用变量吗?
MyCommandPtr-> CommandType = adCmdText;
MyCommandPtr-> CommandText = _bstr_t(_T( SELECT IDENT CURRENT('MyTable')跨度>));
MyRecordsetPtr = MyCommandPtr->执行(NULL,NULL,adCmdText);
/ * 下一步应该是
_variant_t vResult = MyRecordsetPtr-> Fields->项目[1] - >值;
int iResult =(int)vResult; * /
解决方案
我建议你从这里开始:
Visual C ++ ADO编程 [ ^ ]
使用ADO进行数据访问。 NET(C ++ / CLI) [ ^ ]
Visual C ++中的ADO代码示例 [ ^ ]
我希望你能找到你正在寻找的东西;)
假设查询成功并返回至少一条记录,答案是是。另一方面,我很少见到没有FROM的SELECT。
在开发环境之外运行查询(例如,使用SQL +,Management Studio或RDBMS的等效项)。
我不知道你要查询哪个RDBMS。我认为不是SQL Server:Oracle,就我所记得的那样,只要你没有真实表中的数据,就要求你选择FROM DUAL。
希望这会有所帮助,
Pablo。
更新 - 打击无关紧要。
Given the following ADO code segment, how does one retrieve the result of the query.Must one use a variant what?
MyCommandPtr->CommandType = adCmdText;
MyCommandPtr->CommandText = _bstr_t(_T("SELECT IDENT CURRENT ('MyTable')"));
MyRecordsetPtr = MyCommandPtr->Execute(NULL,NULL,adCmdText);
/*Should the next step be
_variant_t vResult = MyRecordsetPtr->Fields->Item[1]->Value;
int iResult = (int)vResult;*/
解决方案
I'd suggest you to start here:
Visual C++ ADO Programming[^]
Data Access Using ADO.NET (C++/CLI)[^]
ADO Code Examples in Visual C++[^]
I hope you'll find waht you're looking for ;)
Assuming the query succeeded and returned at least one record, the answer is yes.On the other hand, I've seldom seen a SELECT without FROM.
Run the query outside your development environment (e.g., using SQL+, Management Studio, or the equivalent for your RDBMS).
I don't know which RDBMS you're querying against. Not SQL Server, I suppose: neither Oracle, which, as far as I remember, requires you to select FROM DUAL whenever you don't have the data in a real table.
Hope this helps,
Pablo.
Updated - striked the irrelevant.
这篇关于任何人都可以帮我解决这个ADO问题吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文