Multiple Insert not working...
Posted: Thu 19 Mar 2009 17:40
Hello,
The following fails to insert data into the tables. It DOES return the correct IDs (it just fails to actually populate the "names" - which is kind of important)
Code:
private void button1_Click(object sender, EventArgs e)
{
Conn.Open();
try
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("insert into foo (foo_name) values (:1) returning id;");
sb.AppendLine("insert into moo (moo_name) values (:2) returning id;");
sb.AppendLine("insert into foo (foo_name) values (:3) returning id;");
sb.AppendLine("insert into noo (noo_name) values (:4) returning id;");
PgSqlCommand cmd = new PgSqlCommand();
cmd.CommandText = sb.ToString();
cmd.Connection = Conn;
cmd.Parameters.Add(new PgSqlParameter("1", "Foo"));
cmd.Parameters.Add(new PgSqlParameter("2", "Moo"));
cmd.Parameters.Add(new PgSqlParameter("3", "Foo2"));
cmd.Parameters.Add(new PgSqlParameter("4", "Noo"));
StringBuilder sb2 = new StringBuilder();
using (PgSqlDataReader reader = cmd.ExecuteReader())
{
do
{
while (reader.Read())
{
sb2.AppendLine(reader.GetString(0));
}
}
while (reader.NextResult());
}
MessageBox.Show(sb2.ToString());
}
finally
{
Conn.Close();
}
}
Note: I'm using protocol 2; Postgres 8.3.4; Devart 4.0.22
I have to say that at this point, I'm getting pretty frustrated with Devart. I feel like everything I try to do other than just doing a simple "select" with no params FAILS.
May I inquire about your QA procedures? I feel like I"m doing your QA. Do you have unit tests for your components? It seems like all of this would be very simple to write unit tests for. Virtually everything is non-visual.
I'm afraid I'm going to have to give up on Devart and ask for refund and go with the freeware components. At least then I have the code and can fix the problems myself.
David
The following fails to insert data into the tables. It DOES return the correct IDs (it just fails to actually populate the "names" - which is kind of important)
Code:
private void button1_Click(object sender, EventArgs e)
{
Conn.Open();
try
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("insert into foo (foo_name) values (:1) returning id;");
sb.AppendLine("insert into moo (moo_name) values (:2) returning id;");
sb.AppendLine("insert into foo (foo_name) values (:3) returning id;");
sb.AppendLine("insert into noo (noo_name) values (:4) returning id;");
PgSqlCommand cmd = new PgSqlCommand();
cmd.CommandText = sb.ToString();
cmd.Connection = Conn;
cmd.Parameters.Add(new PgSqlParameter("1", "Foo"));
cmd.Parameters.Add(new PgSqlParameter("2", "Moo"));
cmd.Parameters.Add(new PgSqlParameter("3", "Foo2"));
cmd.Parameters.Add(new PgSqlParameter("4", "Noo"));
StringBuilder sb2 = new StringBuilder();
using (PgSqlDataReader reader = cmd.ExecuteReader())
{
do
{
while (reader.Read())
{
sb2.AppendLine(reader.GetString(0));
}
}
while (reader.NextResult());
}
MessageBox.Show(sb2.ToString());
}
finally
{
Conn.Close();
}
}
Note: I'm using protocol 2; Postgres 8.3.4; Devart 4.0.22
I have to say that at this point, I'm getting pretty frustrated with Devart. I feel like everything I try to do other than just doing a simple "select" with no params FAILS.
May I inquire about your QA procedures? I feel like I"m doing your QA. Do you have unit tests for your components? It seems like all of this would be very simple to write unit tests for. Virtually everything is non-visual.
I'm afraid I'm going to have to give up on Devart and ask for refund and go with the freeware components. At least then I have the code and can fix the problems myself.
David