#import "c:\program files\common files\system\ado\msado15.dll" no_namespace rename("EOF", "adoEOF") ==>>>#include "stdafx.h"
#include "stdio.h"
#import "C:\PROGRA~1\COMMON~1\System\ado\msado15.dll" no_namespace rename ("EOF", "EOF2")
#include "stdio.h"
#import "C:\PROGRA~1\COMMON~1\System\ado\msado15.dll" no_namespace rename ("EOF", "EOF2")
解决方案 »
- 这3个sql能合并成一个嘛
- 请问各位高手,我的SQL2005登陆只能用Windows身份验证登陆,改了安全属性也不能用SA登陆,怎么办呢?
- 数据库不停的连接、释放会不会到一定时间就不可再连接?
- 在sqlserver2005里,可以用Java吗?
- inner join 后有重复数据的问题?
- 不要看给分少就不回答这个问题,因为我没分了( ODBC连接SQL Server的问题 很简单)
- 要插入一个IMAGIN类型的数据,要如何写语句?和普通的类型一样么?
- 有没有 rename 字段名的SQL??
- TEXT 类型的字段大小固定为16,如何更改?
- How to create a SQL Server event alert to notify operator when a DTS Package fails????
- 如何将sql server中查询到的数据导入成一个excel文件,用vb实现
- 請問有沒有什么工具可以把sql server里的數據轉換成pbd格式﹖
good luckSteps To Reproduce Behavior
In the SQL Server 7.0 Query Analyzer select the test database Pubs.
Create the following stored procedure. This stored procedure returns a recordset and an out parameter count.if exists (select * from sysobjects where id = object_id(N'[dbo].[GetJobs]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop proc GetJobs
go
create proc GetJobs @id as int, @count as int [out] as
begin
Select @count = Count(*) from jobs where job_id >@id
Select * from jobs where job_id >@id
end
go
Use VC App Wizard to create a new console application and modify the code as follows:#include "stdafx.h"
#include "stdio.h"
#import "C:\PROGRA~1\COMMON~1\System\ado\msado15.dll" no_namespace rename ("EOF", "EOF2") struct InitOle {
InitOle() { ::CoInitialize(NULL); }
~InitOle() { ::CoUninitialize(); }
} _init_InitOle_; int main(int argc, char* argv[])
{
_variant_t varErr((long)0, VT_ERROR);
_CommandPtr comm(__uuidof(Command));
_ConnectionPtr conn(__uuidof(Connection)); _bstr_t connstr="Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=pubs;Data Source=(local)";
conn->Open(connstr, "", "", adConnectUnspecified);
comm->ActiveConnection=conn;
comm->CommandText="GetJobs";
comm->CommandType = adCmdStoredProc ;
comm->Parameters->Refresh();
_variant_t recs; comm->Parameters->Item[_variant_t((short)1)]->Value= _variant_t((long)5);
_RecordsetPtr rs = comm->Execute(&recs, &vtMissing,adCmdStoredProc); _variant_t recordcount= comm->Parameters->Item[_variant_t((short)2)]->Value; printf("recordcount = %li\n", (long)recordcount);
return 0;
}
Change the Datasource, User ID and password in the connection string above.
The recordcount variant that the above code returns is of type VT_NULL rather than the number of records that the stored procedure returns.
#import "C:\Program Files\Common Files\System\ado\msado15.dll" \
no_namespace rename ("EOF", "adoEOF") \
rename ("LockTypeEnum", "adoLockTypeEnum") \
rename ("DataTypeEnum", "adoDataTypeEnum") \
rename ("FieldAttributeEnum", "adoFieldAttributeEnum") \
rename ("EditModeEnum", "adoEditModeEnum") \
rename ("RecordStatusEnum", "adoRecordStatusEnum") \
rename ("ParameterDirectionEnum", "adoParameterDirectionEnum")
#endif //#if !defined(__AFXADO_H)
-----------------------------------------
_ConnectionPtr m_pConnection;
m_pConnection.CreateInstance(__uuidof(Connection));
HRESULT hr = S_OK;
hr = m_pConnection->Open(_bstr_t(m_strConnection), "", "", NULL);