Hi Fellows
I still have problem to access my databank.It shows syntax problem,I am using VC++ 2005 with postgresql 8.3.My table name is Person and it has three column,Person ID,first name and last name (testing version).whole c++ code is
// Test_postgres.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "libpq-fe.h"
int _tmain(int argc, _TCHAR* argv[])
{
const char *conninfo;
PGconn *conn;
const char *paramtext = "server_version";
PGresult *res;
conninfo = "hostaddr = 127.0.0.1 dbname = Salman_db user = postgres password = 732047";
conn = PQconnectdb(conninfo);
if (PQstatus(conn) != CONNECTION_OK)
{
printf("Unable to establish connection: %s",
PQerrorMessage(conn));
return 1;
} else
{
res = PQexec(conn, "INSERT INTO public.Person VALUES (221,'Siddiqi','Umer')");
if (PQresultStatus(res) != PGRES_COMMAND_OK)
{
printf("Problem with command: %s\n", PQerrorMessage(conn));
PQclear(res);
PQfinish(conn);
return 1;
}
PQclear(res);
}
PQfinish(conn);
return 0;
}
It shows no relation between public and person,if i write only person ,it show ,Person doesn't exist.
hope, u ppl can help me.
Sheikh Salman Ahmed
Diplomand in Nano Struktur Technologie
Duisburg-Essen Universität
Mobile : 0049-179-9463738
Home :0049-203-3945028
Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! Try it!
No comments:
Post a Comment