ADO.NET "Find Record" method RRS feed

  • Question

  • Hi everyone,

    I used to programm in Delphi/C++ and now I'm learning some C# including ADO.NET. I have database application in Delphi and I'm trying to convert procedures and functions from Delphi code to C# code. There is something else. In Delphi I was working with BDE database controls. Now i'm using ADO.NET.

    This is simple code which shows table "ETATY" content after clicking a button:

    Code Block

            private void btnShowEtaty_Click(object sender, EventArgs e)
                string etetyQuery = "SELECT * FROM Etaty";
                SqlDataAdapter etatyAdapter = new SqlDataAdapter(etetyQuery, SQLConn);
                DataSet EtatyDataSet = new DataSet();
                etatyAdapter.Fill(EtatyDataSet, "Etaty");
                dataGridView1.DataSource = EtatyDataSet.Tables["Etaty"];

    Now I've been trying to find C# (ADO.NET) equivalent of Delphi's (BDE) "Lookup" method. This method allows me to find a record in dataset. I have read some articles and I have found "Find" and "FindRow" method which is used with DataView or with DataRow objects. Are these methods good? Which would be the best? Are there any other methods?

    Thank You for all answers,

    best regards


    Wednesday, January 2, 2008 7:10 PM