C# 如何将整数值从数据库接收到文本框中?
我试图从DB接收一个整数值(车辆号)到一个文本框中,以自动填充框。。。我怎么做?请C# 如何将整数值从数据库接收到文本框中?,c#,asp.net,sql,C#,Asp.net,Sql,我试图从DB接收一个整数值(车辆号)到一个文本框中,以自动填充框。。。我怎么做?请 using (OdbcConnection conexao = new OdbcConnection(con)) { OdbcCommand commandResgVei = new OdbcCommand(textoResgataVeiculo, conexao); conexao.Open();
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;
}
或:
试试这个
vehicle_number.Text = result["vehicle_number"]!=null? convert.toString(
result["vehicle_number"]):"";
试试看
vehicle_number.Text=reader.GetInt32(index);
你想要自动完成文本框还是什么?
Int32.TryParse(text, out parsedInt)
vehicle_number.Text = result["vehicle_number"]!=null? convert.toString(
result["vehicle_number"]):"";
vehicle_number.Text = result["vehicle_number"] as string;
vehicle_number.Text=reader.GetInt32(index);