Imports System.Data.SqlClient
Public Class frmUserRegister
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
End Sub
Private Sub frmUserRegister_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim con As New SqlConnection
Dim cmd As New SqlCommand
Dim strsql As String
con.ConnectionString = "Data Source=localhost; Initial Catalog=ProjectOCR; Integrated Security= true"
cmd.Connection = con
con.Open()
strsql = "INSERT INTO Teacher(teac_id, teac_name, teac_username, teac_password, answer)"
strsql &= "VALUES('" & txtTeacID.Text & "','" & txtTeacName.Text & "','" & txtTeacUsername.Text & "','" & txtTeacPassword.Text & "','" & txtTeacAnswer.Text & "')"
With cmd
.Connection = con
.CommandText = strsql
.CommandType = CommandType.Text
.ExecuteNonQuery()
End With
End Sub
End Class
Imports System.Data.SqlClient
Public Class frmUserRegister
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
Dim con As New SqlConnection
Dim cmd As New SqlCommand
Dim strsql As String
con.ConnectionString = "Data Source=localhost; Initial Catalog=ProjectOCR; Integrated Security= true"
cmd.Connection = con
con.Open()
strsql = "INSERT INTO Teacher(teac_id, teac_name, teac_username, teac_password, answer)"
strsql &= "VALUES('" & txtTeacID.Text & "','" & txtTeacName.Text & "','" & txtTeacUsername.Text & "','" & txtTeacPassword.Text & "','" & txtTeacAnswer.Text & "')"
With cmd
.Connection = con
.CommandText = strsql
.CommandType = CommandType.Text
.ExecuteNonQuery()
End With
End Sub
Private Sub frmUserRegister_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class