首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > CGI >

C++写的CGI怎么实现内部跳转?如何连接postgreSQL数据库

2012-09-18 
C++写的CGI如何实现内部跳转?怎么连接postgreSQL数据库?C++写的CGI部署在阿帕奇服务器。处理表单只能用数字

C++写的CGI如何实现内部跳转?怎么连接postgreSQL数据库?
C++写的CGI部署在阿帕奇服务器。处理表单只能用数字节拆分的方法么?怎么在CGI中实现内部跳转到某个页面呢?另外C++怎么连接postgreSQL数据库啊?大哥们。求救啊

[解决办法]
就是改http头,类似你这句的功能cgiHeaderContentType("text/html");

要按我说的,在<body>中间输出
<meta http-equiv="Refresh" content="0;URL=./cgi-bin/cgictest.cgi">











/* 获取与数据库的连接 */
static int MiMSSqlConnectSQLServer(MsSqlConnectSt *pConnectSt, SQLHENV &henv, SQLHDBC &hdbc)
{
SQLRETURN hRecode;
char szConnOption[1024];
SQLCHAR szConnStrOut[1024]; 
SQLSMALLINT cbConnStrOut = 0;
int nRet = WAVETOP_BACKUP_OK;

/* Allocate environment handle */
hRecode = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv); 
if (hRecode != SQL_SUCCESS && hRecode != SQL_SUCCESS_WITH_INFO) {
nRet = WAVETOP_BACKUP_INVALID_SYNTAX;
goto CLEANUP;
}

/* Set the ODBC version environment attribute */
hRecode = SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (void*)SQL_OV_ODBC3, 0); 
if (hRecode != SQL_SUCCESS &&
hRecode != SQL_SUCCESS_WITH_INFO) {
nRet = WAVETOP_BACKUP_INVALID_SYNTAX;
goto CLEANUP;
}

/* Allocate connection handle */
hRecode = SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc); 
if (hRecode != SQL_SUCCESS && hRecode != SQL_SUCCESS_WITH_INFO) {
nRet = WAVETOP_BACKUP_INVALID_SYNTAX;
goto CLEANUP;
}

/* Set login timeout to 10 seconds. */
SQLSetConnectAttr(hdbc, SQL_LOGIN_TIMEOUT, (void*)10, 0);

/* connect string */
if (stricmp(pConnectSt->szInstance, "MSSQLServer") == 0) {
_snprintf(szConnOption, sizeof(szConnOption), "DRIVER={SQL Server};"
"server=%s;uid=%s;pwd=%s",
pConnectSt->szHostIP, pConnectSt->szDBUser, pConnectSt->szPassword);
}
else {
_snprintf(szConnOption, sizeof(szConnOption), "DRIVER={SQL Server};"
"server=%s\\%s;uid=%s;pwd=%s",
pConnectSt->szHostIP, pConnectSt->szInstance,
pConnectSt->szDBUser, pConnectSt->szPassword);
}

/* Connect to data source */
hRecode = SQLDriverConnect(hdbc,
NULL,
(unsigned char *)szConnOption,
SQL_NTS,
szConnStrOut,
sizeof(szConnStrOut),
&cbConnStrOut,
SQL_DRIVER_NOPROMPT);

if (hRecode != SQL_SUCCESS && hRecode != SQL_SUCCESS_WITH_INFO) {
nRet = WAVETOP_BACKUP_INVALID_SYNTAX;
goto CLEANUP;


return nRet;

CLEANUP:
MiMSSqlClear(henv, hdbc);
return nRet;
}
//大概这样一个过程,最近写的代码,LZ自己看看












------------------------------------------------------------
http://www.jiemengwu.com/ 解梦屋 http://www.phpzy.com/php/ 绿色php资源http://www.shopfw.com网店服务

热点排行