分享

索引(从零开始)必须大于或等于零,且小于参数列表的大小

 牛人的尾巴 2016-03-24

索引(从零开始)必须大于或等于零,且小于参数列表的大小

别说LOVEmE 11级 分类: C#/.NET语言 被浏览49次 2013.11.27

请微博专家回答 检举

string sql = string.Format ("insert into UintInformation(UintName,UintType,Property,UintTel,UintAdders,DeliverAdders,TaxNumber,DepositBank,BankUser,FAX,Email,Corporation,Salesman,UintArea) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}')", this.tUintName.Text, this.cUintType.Text, this.cProperty.Text, tUintTel.Text, tUintAdders.Text, tDeliverAdders.Text, tTaxNumber.Text, tDepositBank.Text, tBankUser.Text, tFAX.Text, tEmail.Text, tCorporation.Text, cSalesman.Text, cUintArea.Text); public int Myupdate(string sql) { SqlCommand oc = new SqlCommand();//表示要对数据源执行的SQL语句或存储过程 oc.CommandText = sql;//设置命令的文本 oc.CommandType = CommandType.Text;//设置命令的类型 oc.Connection = Conn;//设置命令的连接 int x = oc.ExecuteNonQuery();//执行SQL语句 return x;   //返回一个影响行数 } 这样插入数据好麻烦,还报错,有没有更好的方法。要详细点 我是比较新的新手

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多