datasets and direct database connection

Hallo ,

I am using Visual Studio.Net 2003 to develop a windows application. Using a Datagrid i display values from different tables in the database. If i want to delete or update the database, does it make any difference in updating the database directly or using datasets in sense of speed or performance of the programm

I mean like

string myExecuteQuery =  "delete from mytable where name ='john'"
   OdbcConnection myConnection = new OdbcConnection(myConnectionString);
   OdbcCommand myCommand = new OdbcCommand(myExecuteQuery, myConnection);
   myCommand.Connection.Open();
   myCommand.ExecuteNonQuery();
   myConnection.Close();

or with datasets like

dsCustomers1.Customers.Rows[0].Delete();

If i want to delete a large number of records, doest the first method affect the speed of the program


thank u






Answer this question

datasets and direct database connection

  • khubaib

    Hallo,

    first of it seems as if i have posted the thread in the wrong forum. sorry for thath.

    thank you very much for ur reply.if i understand u correctly, the difference is only in the ease of implementation. performance will be the same in both methods. and it must be also logical that both have the same performance. i just wanted to make sure that.

    thank u verymuch





  • Fabio Gouw

    The first method gets accomplished when you've setup a DataAdapter via the VS.NET designer. In other words, the appropriate DeleteCommand, UpdateCommand, InsertCommand and SelectCommand properties get automatically set for you with appropriate Command objects (SqlCommand, OleDbCommand, etc.).

    Therefore, the second option would be the easiest to implement - as it's implemented for you (for the most part).



  • datasets and direct database connection