字符串输入异常 要确保ds.Tables[0].Rows[0]["ISTOWEB"]里面的值可以转换成整数类型可以用Int32.TryParse先判断下 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你先要 convert.isdbnull判断一下. 请问楼上 这个Int32.TryParse怎么用?一个参数s,另一个参数out in resule是什么东东?那我这段代码应该怎么改?谢谢。。麻烦了。 this.dgvMarkArtile.Rows[0].Cells["ISTOWEB"].Value 这是个数字你负责付的字符串 所以报错了你可以将 ds 增加一列来负责 否跟是 显示的时候就绑定 这一列就OK了 sda.Fill(ds); DataColumn dc=null; dc=ds.Tables[0].Columns.Add("num",Type.GetType("System.String")); dc=ds.Tables[0].Columns.Add("type",Type.GetType("System.String")); dc=ds.Tables[0].Columns.Add("statex",Type.GetType("System.String")); for(int i=0;i<ds.Tables[0].Rows.Count;i++) { ds.Tables[0].Rows[i]["num"]=i+1; ds.Tables[0].Rows[i]["statex"]="终结"; string type =ds.Tables[0].Rows[i]["scyx00635"].ToString(); if(type=="1") { ds.Tables[0].Rows[i]["type"]="电气一票"; } else if(type=="2") { ds.Tables[0].Rows[i]["type"]="电气二票"; } dgvMarkArtile.Rows[0].Cells["ISTOWEB"]的数据类型 应该是 int 类型吧你在这里赋值给个字符串类型 貌似不行 8楼的这位朋友。 你这个ds.Tables[0].Rows[i]["type"]="电气一票"; 开始也是int类型吗? 8楼这位朋友 你这个ds.Tables[0].Rows[i]["type"]="电气一票"; 开始也是int类型吗? 我按照你这个方法还是不行啊。。 这个都不会用。楼主太令人蛋疼了。判断的是否==0的时候看看ds.Tables[0].Rows[0]["ISTOWEB"]是不是DBNULL吧。 C# 如何删除 temporary internet files 里的文件 c#居然没有邮件(eml)解析的控件? C#中简单工厂模式非常重要? 请教一高难度的函数转换 C# 中类似VB中 With end With 的语句是什么? 求助!读取图像 100求大虾帮忙!combox绑定报错问题! 在线等待:跪倒求问WinXP下怎么安裝IE5.5,急急急急急急急急!!!!!!!!!!!!! 寻求合作创业! DataGrid1_EditCommand的问题 c#打印小票 想写一个游戏自动登录工具
那我这段代码应该怎么改?谢谢。。麻烦了。
sda.Fill(ds);
DataColumn dc=null;
dc=ds.Tables[0].Columns.Add("num",Type.GetType("System.String"));
dc=ds.Tables[0].Columns.Add("type",Type.GetType("System.String"));
dc=ds.Tables[0].Columns.Add("statex",Type.GetType("System.String"));
for(int i=0;i<ds.Tables[0].Rows.Count;i++)
{
ds.Tables[0].Rows[i]["num"]=i+1;
ds.Tables[0].Rows[i]["statex"]="终结";
string type =ds.Tables[0].Rows[i]["scyx00635"].ToString();
if(type=="1")
{
ds.Tables[0].Rows[i]["type"]="电气一票";
}
else if(type=="2")
{
ds.Tables[0].Rows[i]["type"]="电气二票";
}
你这个ds.Tables[0].Rows[i]["type"]="电气一票"; 开始也是int类型吗?
你这个ds.Tables[0].Rows[i]["type"]="电气一票"; 开始也是int类型吗?
我按照你这个方法还是不行啊。。
判断的是否==0的时候看看ds.Tables[0].Rows[0]["ISTOWEB"]是不是DBNULL吧。