修改新闻的发布按钮(程序如下),没有错误,但是无法修改,不知道修改语句取到值没有。想问问该怎么改!!!Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim strsql, temp As String
temp = Request.QueryString("url")
strsql = "update enews1 set title='" + TextBox1.Text + "',content='" + TextBox2.Text + "',author='" + TextBox3.Text + "'where id='" + temp + "'"
Dim sqlcon As New SqlConnection("SERVER=vabdna;uid=sa;pwd=yy;DATABASE=egov")
sqlcon.Open()
Dim sqlcommand As New SqlCommand
sqlcommand.Connection = sqlcon
sqlcommand.CommandText = strsql
sqlcommand.ExecuteNonQuery()
sqlcon.Close()
sqlcon = Nothing
sqlcommand = Nothing
Response.Redirect("webform3.aspx")
End Sub 不知道该怎么改,盼高手能指点!!!!谢!!!!
Dim strsql, temp As String
temp = Request.QueryString("url")
strsql = "update enews1 set title='" + TextBox1.Text + "',content='" + TextBox2.Text + "',author='" + TextBox3.Text + "'where id='" + temp + "'"
Dim sqlcon As New SqlConnection("SERVER=vabdna;uid=sa;pwd=yy;DATABASE=egov")
sqlcon.Open()
Dim sqlcommand As New SqlCommand
sqlcommand.Connection = sqlcon
sqlcommand.CommandText = strsql
sqlcommand.ExecuteNonQuery()
sqlcon.Close()
sqlcon = Nothing
sqlcommand = Nothing
Response.Redirect("webform3.aspx")
End Sub 不知道该怎么改,盼高手能指点!!!!谢!!!!
Response.Write(strsql);
//Response.Redirect("webform3.aspx")
End Sub 代替
Response.Redirect("webform3.aspx")
End Sub
看看你的SQL语句有没有问题.我看你的代码
+ "'where id='" + temp + "'"中
where前好像少了一空格,如下:
+ "' where id='" + temp + "'"