I have 3 textboxes (EmployeeName, EmployeeNumber, Password)
and 2 drodownlists (Department, JobTitle)
I made a gridview from employee table to insert data to it by clicking Submit button. Now I am facing a problem with the dropdownlist I dont know how to declare it.
Could anyone help me with this.
and 2 drodownlists (Department, JobTitle)
I made a gridview from employee table to insert data to it by clicking Submit button. Now I am facing a problem with the dropdownlist I dont know how to declare it.
Code:
Imports System.Data.SqlClient
Imports System.Data
Partial Class _Default
Inherits System.Web.UI.Page
Dim conn As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\USER\Desktop\WebSite5\App_Data\Database.mdf;Integrated Security=True;User Instance=True")
Dim sqlCom As New SqlCommand
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
conn.Open()
sqlCom.Connection = conn
sqlCom.CommandText = "insert into EmployeeTable (EmpNumber, EmpName, DepartmentName, JobTitle, Password) VALUES ('" & TextBoxEmployeeNumber.Text & "', '" & TextBoxEmployeeName.Text & "', '" & TextBoxDepartment.Text & "', '" & TextBoxJobTitle.Text & "', '" & TextBoxPassword.Text & "')"
sqlCom.ExecuteNonQuery()
conn.Close()
End Sub
End Class
Comment