关于update语句
comm.CommandText = "update problem set problem_type=@problem_type,sameid_number=@sameid_number,way_self=@way_self,person_self=@person_self,date_fin=@date_fin,status_problem=@status_problem where id_number='" & Request.QueryString("id") & "'"
comm.Connection = conn
comm.Parameters.Add("@problem_type", Data.SqlDbType.Int).Value = problemtype
comm.Parameters.Add("@sameid_number", Data.SqlDbType.NChar).Value = Trim(TBProblemID.Text)
comm.Parameters.Add("@way_self", Data.SqlDbType.NChar).Value = Trim(TBSolveContent.Text)
comm.Parameters.Add("@person_self", Data.SqlDbType.NChar).Value = Session("username")
comm.Parameters.Add("@date_fin", Data.SqlDbType.DateTime).Value = Now
comm.Parameters.Add("@status_problem", Data.SqlDbType.Int).Value = solveeither
comm.ExecuteNonQuery()
为什么说变量名@problem_type已经声明了呢
------解决方案--------------------你的一个comm对象再次使用的时候要先
comm.Parameters.Clear();
因为你上次已经给了,
------解决方案--------------------C# code
楼上说的是,慢了一步
comm.CommandText = "update problem set problem_type=@problem_type,sameid_number=@sameid_number,way_self=@way_self,person_self=@person_self,date_fin=@date_fin,status_problem=@status_problem where id_number='" & Request.QueryString("id") & "'"
[color=#FF0000]comm.Parameters.Clear();[/color]
comm.Connection = conn
comm.Parameters.Add("@problem_type", Data.SqlDbType.Int).Value = problemtype
comm.Parameters.Add("@sameid_number", Data.SqlDbType.NChar).Value = Trim(TBProblemID.Text)
comm.Parameters.Add("@way_self", Data.SqlDbType.NChar).Value = Trim(TBSolveContent.Text)
comm.Parameters.Add("@person_self", Data.SqlDbType.NChar).Value = Session("username")
comm.Parameters.Add("@date_fin", Data.SqlDbType.DateTime).Value = Now
comm.Parameters.Add("@status_problem", Data.SqlDbType.Int).Value = solveeither
comm.ExecuteNonQuery()