Regarding mulitple rows insert in one shot using ADO .net connected to postgres

Поиск
Список
Период
Сортировка
От keshav upadhyaya
Тема Regarding mulitple rows insert in one shot using ADO .net connected to postgres
Дата
Msg-id d40c44910910072339l33f32cfkd9886c610b71d55b@mail.gmail.com
обсуждение исходный текст
Ответы Re: Regarding mulitple rows insert in one shot using ADO .net connected to postgres  (Gurjeet Singh <singh.gurjeet@gmail.com>)
Список pgsql-novice
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

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

Предыдущее
От: richard terry
Дата:
Сообщение: syntax of \copy
Следующее
От: Gurjeet Singh
Дата:
Сообщение: Re: Regarding mulitple rows insert in one shot using ADO .net connected to postgres