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; //返回一个影响行数
}
这样插入数据好麻烦,还报错,有没有更好的方法。要详细点 我是比较新的新手