<%@ Page Language="VB" Debug="true" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SQLClient" %>
<script language="VB" runat="server">
Sub Page_Load(Source as Object, E as EventArgs)
Dim conn As New SQLConnection("server=LOCALHOST;User id='sa';password='123';database=Northwind")
Dim DeleteCommand As SqlCommand = New SqlCommand()
DeleteCommand.Connection = conn
Dim sql As String = "Delete from categories WHERE CategoryID = @CatID"
DeleteCommand.CommandText = sql
DeleteCommand.Parameters.Add("@CatID", SqlDbType.Int).Value = 14
Try
conn.Open()
DeleteCommand.ExecuteNonQuery()
Catch ex As Exception
response.Write(ex.ToString())
Finally
conn.Close()
End Try
End sub
{ 0 nhận xét... read them below or add one }
Đăng nhận xét