Imports System.Data
Imports System.Data.SqlClient
Public Class editing
Inherits System.Web.UI.Page
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Dim cn As New SqlConnection("server=localhost;uid=sa;pwd=123;database=article;")
Dim cm As SqlCommand
Dim artname As String
Dim text As String
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
artname = Request.QueryString("name")
cm = New SqlCommand("select text from article where artname='" & artname & "'", cn)
cn.Open()
TextBox1.Text = cm.ExecuteScalar
cn.Close()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
cm = New SqlCommand("update article set text = @text where artname = '" & artname & "'", cn)
cm.Parameters.Add("@text", TextBox1.Text)
cn.Open()
cm.ExecuteNonQuery()
cn.Close()
Response.Redirect("editarticle.aspx?edited=yes")
End Sub
End Class