求完整版VC++连接postgresql方法,求代码. 没怎么用过VC连接数据库,对很多概念不时很熟悉,求各位大虾,能发发慈悲,尽量详细的介绍下方法.一步一步来啊!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://www.google.com.sg/#hl=en&newwindow=1&biw=1259&bih=819&q=VC+postgresql&aq=f&aqi=&aql=&oq=&fp=e871449940a31f1a #include “stdafx.h”#includechar * string_for_query;;PGconn *Conn_pointer;PGresult *result;char* pghost = “localhost”; //IP address string is also okchar* pgport =”5432″;char* pgoptions =NULL;char* pgtty = NULL;char* dbName = “school”;char* username = “postgres”; //postegres is the username thatchar* password = “123456″ ;//set when insalled cannot get directly#pragma comment(lib,”C:\\Program Files\\PostgreSQL\\8.3\\lib\\libpq.lib”)int main(){Conn_pointer=PQsetdbLogin(pghost, pgport, pgoptions, pgtty, dbName, username, password);if (PQstatus(Conn_pointer) == CONNECTION_BAD){printf(“cannot connect to the database!\n”);return -1;}printf (“Connect to database seccess\n”);return 0;} 在这个层次上不区分 vc 还是什么 c. 运行时出现没有找到LIBPQ.dll,但是文件的确就在那个目录下啊。 向主表和子表同时插入数据如何写SQL语句 mysql中有关查询in的用法 江湖救急:OCTET_LENGTH 函数能否获取二进制blob字段的长度? 请教一个innodb_buffer_pool_size的问题 站内搜索引擎 问一个mysql的sql语法问题,谢谢 如何用Select查询两个数据库中的表 如何导出用户表 100分 急 求一MySql管理工具 sqlyog 连接mysql问题 最规范的java连接mysql的实例 请教一个关于MySQL 内存数据库的问题
#includechar * string_for_query;;
PGconn *Conn_pointer;
PGresult *result;char* pghost = “localhost”; //IP address string is also ok
char* pgport =”5432″;
char* pgoptions =NULL;
char* pgtty = NULL;
char* dbName = “school”;
char* username = “postgres”; //postegres is the username that
char* password = “123456″ ;//set when insalled cannot get directly#pragma comment(lib,”C:\\Program Files\\PostgreSQL\\8.3\\lib\\libpq.lib”)
int main()
{
Conn_pointer=PQsetdbLogin(pghost, pgport, pgoptions, pgtty, dbName, username, password);
if (PQstatus(Conn_pointer) == CONNECTION_BAD)
{
printf(“cannot connect to the database!\n”);
return -1;
}
printf (“Connect to database seccess\n”);
return 0;
}