日期:2014-05-18  浏览次数:20421 次

扩展存储过程的问题,谢谢
描述:通过输入两个参数,得到输出参数:例如param1是 "你好 ",param2是 "谢谢 ",我想得到输出参数为 "param1=你好&param2=谢谢 ",以下是我的程序,但我在sql   server中执行不了,请高手指点,谢谢:
#include   <stdafx.h>
#include   "srv.h "
#define   XP_NOERROR                             0
#define   XP_ERROR                                 1
#define   MAXCOLNAME 25
#define   MAXNAME 25
#define   MAXTEXT 255

#ifdef   __cplusplus
extern   "C "   {
#endif

RETCODE   __declspec(dllexport)   xp_tongcardpos(SRV_PROC   *srvproc);

#ifdef   __cplusplus
}
#endif

RETCODE   __declspec(dllexport)   xp_tongcardpos(SRV_PROC   *srvproc)
{

        DBCHAR   colname[MAXCOLNAME];
DBCHAR   spName[MAXNAME];
DBCHAR   spText[MAXTEXT];
DBCHAR   spMerid[MAXTEXT];

BOOL   bNull;                                       //   记录入参是否为空(NULL)
        PBYTE   bType;                                     //   入参的类型
        ULONG   uMaxLen   =   20;                       //   入参的最大长度,令为20字节
ULONG   uLen;                           //   入参的实际长度

//Send   a   text   message
//   Check   that   there   are   the   correct   number   of   parameters.
        if   (   srv_rpcparams(srvproc)   !=   1   )
        {
                //   If   there   is   not   exactly   one   parameter,   send   an   error   to   the   client.
                _snprintf(spText,   MAXTEXT,   "ERROR.   You   need   to   pass   one   parameter. ");
                srv_sendmsg(   srvproc,   SRV_MSG_INFO,   0,(DBTINYINT)0,  
                                      (DBTINYINT)0,NULL,0,0,spText,SRV_NULLTERM);

                //   Signal   the   client   that   we   are   finished.
                srv_senddone(srvproc,   SRV_DONE_ERROR,   (DBUSMALLINT)0,   (DBINT)0);

                return   XP_ERROR;
        }


//   Get   the   info   about   the   parameter.
        //   Note   pass   NULL   for   the   pbData   parameter   to   get
        //   information   rather   than   the   paramet