From: | keshav upadhyaya <ukeshav2009(at)gmail(dot)com> |
---|---|
To: | Gurjeet Singh <singh(dot)gurjeet(at)gmail(dot)com> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Regarding mulitple rows insert in one shot using ADO .net connected to postgres |
Date: | 2009-10-08 07:29:46 |
Message-ID: | d40c44910910080029j210937c7g975aa4850119b54d@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice pgsql-performance |
Hi Gurjeet ,
THanks for ur help , But from ADO .net we have to go through the code which
i have written in RED .
If I am using direct sql command then I can do the way u have suggested .
But from the ADO .net i need to get the *CommandText and then add the
values of each parameter after that
execute Query .
What I want here is I will load the multi row data as parameter and then
execute Query only once .
Thanks
keshav
*
On Thu, Oct 8, 2009 at 12:32 PM, Gurjeet Singh <singh(dot)gurjeet(at)gmail(dot)com>wrote:
> Try the multi-row INSERT syntax:
>
> From the docs:
>
> To insert multiple rows using the multirow VALUES syntax:
>
> INSERT INTO films (code, title, did, date_prod, kind) VALUES
> ('B6717', 'Tampopo', 110, '1985-02-10', 'Comedy'),
> ('HG120', 'The Dinner Game', 140, DEFAULT, 'Comedy');
>
>
> Best regards,
>
>
> On Thu, Oct 8, 2009 at 12:09 PM, keshav upadhyaya <ukeshav2009(at)gmail(dot)com>wrote:
>
>> Hi ,
>>
>> I want to insert multiple Rows in one shot to improve my performance .
>>
>> From C# code I am using ADO .net to connect to postgres .
>> Currently i am pasting the code which is not of postgres but in my dev
>> environment similar things i am doing with Postgres.
>>
>> MySqlConnection mySql = new MySqlConnection();
>> mySql.CreateConn();
>> mySql.Command = mySql.Connection.CreateCommand();
>> * mySql.Command.CommandText = "INSERT INTO dbo.table1 (textBox1,
>> textBox2) VALUES (@textBox1, @textBox2)";
>>
>> mySql.Command.Parameters.Add("@textBox1", SqlDbType.VarChar);
>> mySql.Command.Parameters["@textBox1"].Value = TextBox1.Text;
>> mySql.Command.Parameters.Add("@textBox2", SqlDbType.VarChar);
>> mySql.Command.Parameters["@textBox2"].Value = TextBox2.Text;
>>
>> mySql.Command.ExecuteNonQuery();
>>
>> * mySql.Command.Dispose();
>> mySql.Connection.Close();
>> mySql.CloseConn();
>>
>>
>> Hi i have hilighted the line in which I wanted to ask doubts .
>>
>> Currently i am inserting one row in one time and then executing the query
>> .
>> So with this approach i need to execute it many times for multiple rows
>> insert because of this my database is poor in doing this each time for very
>> large data.
>>
>> What i want here is to insert multiple rows and then executing it in one
>> time only so that it will be faster.
>>
>> Please help me out in this regards .
>>
>> --
>> Thanks,
>> Keshav Upadhyaya
>>
>
>
>
> --
> Lets call it Postgres
>
> EnterpriseDB http://www.enterprisedb.com
>
> gurjeet[(dot)singh](at)EnterpriseDB(dot)com
>
> singh(dot)gurjeet(at){ gmail | hotmail | indiatimes | yahoo }.com
> Twitter: singh_gurjeet
> Skype: singh_gurjeet
>
> Mail sent from my BlackLaptop device
>
--
Thanks,
Keshav Upadhyaya
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Wood | 2009-10-09 07:08:31 | Re: /Var Partition Full - How can a change PGDATA? |
Previous Message | Gurjeet Singh | 2009-10-08 07:02:06 | Re: Regarding mulitple rows insert in one shot using ADO .net connected to postgres |
From | Date | Subject | |
---|---|---|---|
Next Message | Ludwik Dylag | 2009-10-08 09:19:26 | Query logging time, not values |
Previous Message | Gurjeet Singh | 2009-10-08 07:02:06 | Re: Regarding mulitple rows insert in one shot using ADO .net connected to postgres |