string cc=sf.SelectedItem.Text;
string provinceidstr="SELECT i_ProvinceID FROM TBL_Province where vc_ProvinceName='"+cc+"'";
SqlCommand xx=new SqlCommand(provinceidstr,this.sqlConnection1);
SqlDataReader sfid=xx.ExecuteReaderCommandBehavior.SingleResult);
while(sfid.Read())
{
// object 型与int 型不能直接转换
//int rep=(int)sfid[0];
int rep = Convert.ToInt32(sfid[0]);
}
sfid.Close();
string provinceidstr="SELECT i_ProvinceID FROM TBL_Province where vc_ProvinceName='"+cc+"'";
SqlCommand xx=new SqlCommand(provinceidstr,this.sqlConnection1);
SqlDataReader sfid=xx.ExecuteReaderCommandBehavior.SingleResult);
while(sfid.Read())
{
// object 型与int 型不能直接转换
//int rep=(int)sfid[0];
int rep = Convert.ToInt32(sfid[0]);
}
sfid.Close();
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货