#include<stdio.h>
#include "/usr/include/libpq-fe.h"

void main()
{

PGconn *conn;
PGresult *res;
int id;
char name[20];
char *qur;

conn =
PQsetdbLogin("127.0.0.1","5432",NULL,NULL,"postgres","postgres",NULL);


  if(PQstatus(conn)==CONNECTION_OK)
  {
    printf("Connection Established\n\n");


   printf("Enter the ID: \n");
   scanf("%d",&id);
   printf("Enter the NAME: \n");
   scanf("%s",&name);
  *qur="insert into table values(id,name)";      <--------Error here, Why?
   res = PQexec(conn,qur);

    PQfinish(conn);
   }
   else
   {
     printf("Connection Failed\n");
   }


}
_______________________________________________
Mailinglist mailing list
[email protected]
http://ilug-cochin.org/mailman/listinfo/mailinglist_ilug-cochin.org

Reply via email to