protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "select FromYear from Factory where Cal_ID='" + DropDownList1.SelectedItem.Text + "'";
cmd.Connection = con;
con.Open();
dr = cmd.ExecuteReader();
dr.Read();
d = dr[0].ToString();
//d =(string) Label4.Text;
con.Close();
}
데이터베이스에서 정수 값을 원합니다.
시험
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "select FromYear from Factory where Cal_ID='" + DropDownList1.SelectedItem.Text + "'";
cmd.Connection = con;
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
dr.Read();
int d = dr.GetInt32(0);
con.Close();
dr.GetInt32(0)
위치 0에서 int를 읽어야합니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다