Imports System.Data Imports System.Data.SqlClient Public Class AddNew Inherits System.Web.UI.Page Protected WithEvents Label1 As System.Web.UI.WebControls.Label Protected WithEvents Label2 As System.Web.UI.WebControls.Label Protected WithEvents NewName As System.Web.UI.WebControls.TextBox Protected WithEvents NewEmail As System.Web.UI.WebControls.TextBox Protected WithEvents Button1 As System.Web.UI.WebControls.Button #Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer. 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 Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim sDSN As String sDSN = "server=student.bus.olemiss.edu;uid=dbdemo;pwd=dbpass;database=EmailDemo" Dim MyConnection As SqlConnection Dim MyCommand As SqlCommand Dim MySQL As String MySQL = "INSERT INTO Students (StudentName, StudentEmail) SELECT '" & NewName.Text & "' AS StudentName, '" & NewEmail.Text & "' as StudentEmail" MyConnection = New SqlConnection(sDSN) MyCommand = New SQLCommand(MySQL) MyCommand.Connection = MyConnection MyConnection.Open() MyCommand.ExecuteNonQuery() MyConnection.Close() MyCommand.Dispose() MyConnection.Dispose() End Sub End Class