Private Sub search_ext()
Dim myConn As SqlConnection
myConn = New SqlConnection(ConfigurationManager.ConnectionStrings("PhoneBook_2ConnectionString").ConnectionString)
Dim myCommand2 As SqlCommand = New SqlCommand()
myCommand2.CommandText = "SELECT [Users].Name_TH AS 'ชื่อ', [Users].Surname_TH AS 'นามสกุล',Position.ID_Position AS 'ตำแหน่ง',Dept.ID_Dept AS 'แผนก/สาขา', [Users].Tel AS 'เบอร์โทร', [Users].Tex_Ext AS 'เบอร์ต่อ',[Users].ID "
myCommand2.CommandText &= " FROM [Users] INNER JOIN Dept ON [Users].ID_Dept = Dept.ID_Dept INNER JOIN Position ON [Users].ID_Position = Position.ID_Position "
myCommand2.CommandText &= " WHERE [Users].Tex_Ext LIKE '%" & TextBox1.Text & "%'"
myCommand2.CommandType = CommandType.Text
myCommand2.Connection = myConn
myCommand2.Connection.Open()
Dim myReader2 As SqlDataReader
myReader2 = myCommand2.ExecuteReader(CommandBehavior.CloseConnection)
GridView1.DataSource = myReader2
GridView1.DataBind()
myCommand2.Dispose()
myConn.Dispose()
End Sub