![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Professional Programmer
Join Date: Mar 2005
Posts: 332
Rep Power: 4
![]() |
Adding Parameters at creation time for MySqlCommand?
Anyone know if you can add parameters, my current code is
using (MySqlConnection myConnection = new MySqlConnection(ConnectionString))
using (MySqlCommand myInsert = new MySqlCommand(myInsertQuery,myConnection))
{
myConnection.Open();
//Add the parameters to the insert query
myInsert.Parameters.Add(ParamReturnCode);
myInsert.Parameters.Add(ParamReturnDescription);
//Data was not found, run the insert query
myInsert.ExecuteNonQuery();
}which works fine, but I want to know if I can remove the myInsert.Parameters.Add commands and include them in the using to squash the code down even more (not sure if I want to, but I want to know if it's an option). Last edited by Arla; Jun 10th, 2005 at 2:55 PM. Reason: Removed some spacing from the code |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|