using (SqlConnection conn = conMgr.GetDatabaseConnection())
{
using (SqlCommand cmd = new SqlCommand("getEdit", conn))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("@id", id));
cmd.Connection = conn;
using (SqlDataReader rdr = cmd.ExecuteReader(CommandBehavior.CloseConnection))
{
while (rdr.Read())
{
TextBox1.Text = rdr.GetInt32(rdr.GetOrdinal("id")).ToString();
TextBox2.Text = rdr.GetString(rdr.GetOrdinal("name"));
DropDownList4.SelectedValue = rdr.GetString(rdr.GetOrdinal("country"));
string dt = rdr.GetString(rdr.GetOrdinal("dob"));
Label14.Text = dt;
}
rdr.Close();
}
}
dob 是日期时间类型。所以请告诉我如何使用标签显示它。如何将日期时间对象转换为 srting 类型。