Administrator

Administrator

  • Tech Writer
  • 2.2k
  • 1.5m

how to read only one field of a table

Feb 26 2003 7:03 AM
I have a database called HARPIA. In this database i have a table called GENERO, and in this table i have three fields (N_GENERO, GENERO, N_TRIBO). I would like to read only the values into the field N_GENERO and show its values in a Combobox called cboGenero. To do this i used the code below but its not so good. I have some problems with this code. There is anybody that can help me. Whats the correct code to use? thisAdapter = new OleDbDataAdapter( "SELECT n_genero FROM genero WHERE genero = '+ nomegenero'", dbBanco.thisConnection); thisBuilder = new OleDbCommandBuilder(thisAdapter); thisDataSet = new DataSet(); thisAdapter.Fill(thisDataSet,"genero"); cboGenero.text = thisDataSet.Tables ["genero"].Columns ["n_genero"]; }

Answers (4)