How will I customise my commands.
Posted by: ADEBISI Foluso
Date: December 02, 2004 09:09AM

Hi fellow programmers,

I find it difficult to customize my "MySqlCommand" objects. I mean the Insert, Update, Delete commands.

After following the normal customization procedure, an exception is always thrown each time I want to update my "MySqlDataAdapter" object.

My customization procedure is as follows:
-----------------------------------------------------------
MySqlConnection conn = new MySqlConnection(connectStr);
MySqlDataAdapter adapter = new MySqlDataAdapter (queryStr, conn);
...
MySqlCommand insert = conn.CreateCommand();
insert.CommandText = "insert into my_table values (@field1, @field2, . . .)";

//I add the parameters to each MySqlCommand Object
insert.Parameters.Add("@field1", MySqlDbType.Char, 4, "field1_name");
insert.Parameters.Add("@field2", MySqlDbType.Char, 10, "field2_name");
adapter.InsertCommand = insert;
...
adapter.Update(my_dataset); //An exception is thrown here.
-----------------------------------------------------------

I was succesfull when I use a MySqlCommandBuilder object for this. But I want to customize the other commands to my taste without this object.

I will be very grateful for any solution given.

Options: ReplyQuote


Subject
Written By
Posted
How will I customise my commands.
December 02, 2004 09:09AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.