update 问题 初学者
update Conews set content= 'Content.Text ',title= 'Title .Text ',time= 'Time.Text ',classname= 'NewsType.Text ' 到底是错在哪里呀,, 初学者
[解决办法]
update Conews set content= ' "+Content.Text+ " ',title= ' "+Title .Text+ " ',time= ' "+Time.Text+ " ',classname= ' "+NewsType.Text+ " '
[解决办法]
格式还要注意,TIME那个字段用TEXT肯定不行吧,转化一下
[解决办法]
strSQL = "update Conews set content= ' " + Content.Text + " ',title= ' " + Title .Text + " ',time= ' " + Time.Text + " ',classname= ' " + NewsType.Text + " ' where ID= " + Convert.ToInt32(Request.QueryString[ "ID "]);
[解决办法]
'Content.Text '
代表是常量
[解决办法]
为什么不用参数啊
[解决办法]
where ID=??
[解决办法]
int flag = 0;
string Query = "update imglinks set linkname=@name,linkimg=@img,linkurl=@url where linkid=@id ";
SqlComm = new SqlCommand(Query,SqlConn);
SqlComm.Parameters.Add( "@name ", SqlDbType.VarChar, 50).Value = name;
SqlComm.Parameters.Add( "@img ", SqlDbType.VarChar, 50).Value = img;
SqlComm.Parameters.Add( "@url ", SqlDbType.VarChar, 50).Value = url;
SqlComm.Parameters.Add( "@id ", SqlDbType.VarChar, 50).Value = id;
SqlConn.Open();
flag = SqlComm.ExecuteNonQuery();
SqlConn.Close();
return flag;