Imports System.Data.SqlClient
Partial Public Class WebForm23 Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load End Sub Protected Sub btnclear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnclear.Click txtfirstname.Text = " " txtmiddlename.Text = " " txtlastname.Text = " " txtaddress.Text = " " txteducation.Text = " " End Sub Private Sub btnsubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsubmit.Click Dim con As New System.Data.SqlClient.SqlConnection Dim SQLstrng As String con.ConnectionString = "Password=dbserversql;Persist Security Info=True;User ID=sa;Initial Catalog=Northwind;Data Source=DBSERVER" con.Open() SQLstrng = "insert into candidate values('" & txtfirstname.Text & "' , '" & txtmiddlename.Text & "','" & txtlastname.Text & "','" & txtaddress.Text & "','" & txteducation.Text & "')" Dim Cmd As New System.Data.SqlClient.SqlCommand(SQLstrng, con) 'Cmd.CommandText = SQLstrng Cmd.CommandType = CommandType.Text 'con.Open() Cmd.ExecuteNonQuery()
con.Close() End Sub End Class