SqlConnection con5 = dataOperate.createCon();
con5.Open();
SqlCommand com5 = new SqlCommand("select 赔偿比例 from 损坏赔偿 where 损坏程度='" + DropDownList1.SelectedValue + "'", con5);
SqlDataReader dr5 = com5.ExecuteReader();
dr5.Read();
int bili =int.Parse(dr5["赔偿比例"]);
dr5.Close();
con5.Close();就是这里int bili =int.Parse(dr5["赔偿比例"]);转换不成功 用convert.toint32也不对 帮帮忙 谢谢了
con5.Open();
SqlCommand com5 = new SqlCommand("select 赔偿比例 from 损坏赔偿 where 损坏程度='" + DropDownList1.SelectedValue + "'", con5);
SqlDataReader dr5 = com5.ExecuteReader();
dr5.Read();
int bili =int.Parse(dr5["赔偿比例"]);
dr5.Close();
con5.Close();就是这里int bili =int.Parse(dr5["赔偿比例"]);转换不成功 用convert.toint32也不对 帮帮忙 谢谢了
解决方案 »
- asp转asp.net 利用现有的C++做的DLL,C#好还是VB
- "select new" 返回值问题
- Datalist里面Button/LinkButton无法跳转页面
- 上传图片时如何限制图片的大小和尺寸?
- listBox插入數據庫的問題
- 怎样加密cookie?????
- 用webrequest取得一个电影网站其中的一部电影的src 在自己本地运行程序和放到空间服务器上运行,得到的src怎么会不一样
- 看了所有csdn以前相关的贴,还是不知道错在哪,求助,在线
- 关于下拉菜单的问题
- 表单提交问题
- asp.net中RadioButtonList控件,如何要求必选其中一项的验证?
- 【急】网站有被挂马了
{
int bili = Convert.ToInt32(dr5["赔偿比例"]);
}
if(dr5["赔偿比例"] != DBNull.Value)
{
int bili = int.Parse(dr5["赔偿比例"].ToString());
}
int i = 1;
int.TryParse(dr5["赔偿比例"].ToString(),out i);
//你可以看看dr5["赔偿比例"]是什么样数据
参考:http://msdn.microsoft.com/zh-cn/library/f02979c7%28v=VS.80%29.aspx
con5.Open();
SqlCommand com5 = new SqlCommand("select 赔偿比例 from 损坏赔偿 where 损坏程度='" + DropDownList1.SelectedValue + "'", con5);
SqlDataReader dr5 = com5.ExecuteReader();
if (dr5.Read())
int bili =int.Parse(dr5["赔偿比例"]);
com5.Dispose();
con5.Close();
public static Table Get()
{
SqlConnection con5 = dataOperate.createCon();
con5.Open();
SqlCommand com5 = new SqlCommand("select 赔偿比例 from 损坏赔偿 where 损坏程度='" + DropDownList1.SelectedValue + "'", con5);
SqlDataReader dr5 = com5.ExecuteReader();
dr5.Read();
if(dr5.Read())
{
Table tb =new Table();
tb.要求的字段(ID类型的)=int.Parse(dr5["赔偿比例"]);
dr5.Close();
con5.Close();
return tb;
}
else
{
read.Close();
return null;
}
}