问题描述
我用asp.net+access去更新但是更新不了,但能删除和insert{sql语句没有错}代码如下//添加删除更新publicintExcount(stringcommandText,paramsOleDbParameter[]paras){OleDbCommandcmd=newOleDbCommand(commandText,oledbConn);try{foreach(OleDbParameterpinparas){cmd.Parameters.Add(p);}oledbConn.Open();return(int)cmd.ExecuteNonQuery();}catch(OleDbExceptionex){Console.WriteLine("InMaincatchblock.Caught:{0}",ex.Message);Console.WriteLine("InnerExceptionis{0}",ex.InnerException);throwex;}finally{cmd.Dispose();oledbConn.Close();}}///<summary>///更新一条数据///</summary>publicintUpdatefriend(friendfri){stringsql="updatefriendsetfriendname=@friendname,friendurl=@friendurlwherefriendid=@friendid";OleDbParameter[]parameters={newOleDbParameter("@friendid",OleDbType.Integer,4),newOleDbParameter("@friendname",OleDbType.VarChar,50),newOleDbParameter("@friendurl",OleDbType.VarChar,50)};parameters[0].Value=fri.friendid;parameters[1].Value=fri.friendname;parameters[2].Value=fri.friendurl;returnsqlhelp.Excounts(sql.ToString(),parameters);}sss.csinta=int.Parse(this.GridView1.DataKeys[e.RowIndex]["friendid"].ToString());stringname=((GridView1.Rows[e.RowIndex].Cells[0].FindControl("TextBox1"))asTextBox).Text.ToString();stringcount=((GridView1.Rows[e.RowIndex].Cells[1].FindControl("TextBox2"))asTextBox).Text.ToString();friendvov=newfriend();vov.friendname=name;vov.friendid=a;vov.friendurl=count;Bllfriend.Updatefriend(vov);//更新请问哪位高人指点一下啊