How to search a Record in DataTable C#

Contoh coding


DataRow[] foundRows = dtvstations.Select("stationname =  'KL' ");

conn = foundRows[0]["connstring"].ToString();


Apply method

private void CB_vstation_SelectedIndexChanged(object sender, EventArgs e)

        {

            if(CB_vstation.Text.ToString() != "")

            {

                string exp = "stationname = '" + CB_vstation.Text.ToString() + "'";

                MessageBox.Show(exp);

                DataRow[] foundRows = dtvstations.Select(exp);

                conn = foundRows[0]["connstring"].ToString();

                viewByStation(conn);

            }

        }



Rujukan :

C# -syntax error: missing operand after 'TAG' operator.

Ulasan

Catatan popular daripada blog ini

SISTEM PENGOPERASIAN KOMPUTER (OS)

JENIS-JENIS SISTEM PENGOPERASIAN KOMPUTER

APA ITU ASCII (AMERICAN STANDARD CODE FOR INFORMATION INTERCHANGE) ?