0

我试图从 DB 接收一个整数值(vehicle_number)到一个文本框中,自动填充框......我该怎么做?请

using (OdbcConnection conexao = new OdbcConnection(con))
            {
                OdbcCommand commandResgVei = new OdbcCommand(textoResgataVeiculo, conexao);
                conexao.Open();

                OdbcDataReader result = commandResgVei.ExecuteReader();
                resultado.Read();
                vehicle_number.Text = ?????????????????????????? // how?
                name.Text = result["name"] as string;


            }
4

4 回答 4

0
while(rdr.Read())
{
     text = rdr["<name>"].ToString();
}

如果你真的需要解析它,那么你可以尝试:

reader.GetInt32(/*index*/);

或者:

Int32.TryParse(text, out parsedInt)
于 2013-10-23T05:55:35.287 回答
0

尝试这个

vehicle_number.Text =  result["vehicle_number"]!=null? convert.toString( 
result["vehicle_number"]):"";
于 2013-10-23T05:55:37.280 回答
0
vehicle_number.Text = result["vehicle_number"] as string;
于 2013-10-23T05:55:58.243 回答
0

试试看

 vehicle_number.Text=reader.GetInt32(index);
于 2013-10-23T05:57:08.547 回答