Re: Help regarding INSERT INTO statement

Поиск
Список
Период
Сортировка
От paul butler
Тема Re: Help regarding INSERT INTO statement
Дата
Msg-id 3EF2E0EB.21614.9DDE3DE@localhost
обсуждение исходный текст
Ответ на Help regarding INSERT INTO statement  ("Smitha V. Babu" <smitha.v@sonata-software.com>)
Список pgsql-novice
From:               "Smitha V. Babu" <smitha.v@sonata-software.com>
To:                 pgsql-novice@postgresql.org
Subject:            [NOVICE] Help regarding INSERT INTO statement
Date sent:          Fri, 20 Jun 2003 13:54:44 +0530

Does this help?

PGresult *res;
char *name="smitha";
char *address="Bangalore";

sprintf(query_1, "INSERT INTO data(UserName,UserAddress)
VALUES('%s','%s')",name,address);

res =PQexec(conn,query_1);

>
> Hi all,
> In my pgm i want to insert to the table a number of data..
> I want toinsert it through variable names...
> my program look like this
>
> char *name="smitha";
> char *address="Bangalore";
>
> PQexexc(conn,"INSERT INTO data VALUES(name,address)");
>
> whare data is the tablename having two fields UserName and UserAddress...
>
> but this doesn't works
>
> Can any one of u help me....
>
> Thanking in advance..
> smitha
>
> *********************************************************************
> Disclaimer: The information in this e-mail and any attachments is
> confidential / privileged. It is intended solely for the addressee or
> addressees. If you are not the addressee indicated in this message, you may
> not copy or deliver this message to anyone. In such case, you should destroy
> this message and kindly notify the sender by reply email. Please advise
> immediately if you or your employer does not consent to Internet email for
> messages of this kind.
> *********************************************************************
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster



В списке pgsql-novice по дате отправления:

Предыдущее
От: "Smitha V. Babu"
Дата:
Сообщение: Help regarding INSERT INTO statement
Следующее
От: Dani Oderbolz
Дата:
Сообщение: Starting psql from Script - how to pass the password?