dropAssigned.SelectedValue.
-
Hello! I have this sql statement below: Dim strSQL As String = "SELECT EmailAdd from vwDepList where Member_ID =' " & dropAssigned.SelectedValue & "'" I want that my lblEmailAdd.text will refelect the value of strSQL depending on the dropAssigned.SelectedValue. Need a tutorial. Thanks.:)
-
Hello! I have this sql statement below: Dim strSQL As String = "SELECT EmailAdd from vwDepList where Member_ID =' " & dropAssigned.SelectedValue & "'" I want that my lblEmailAdd.text will refelect the value of strSQL depending on the dropAssigned.SelectedValue. Need a tutorial. Thanks.:)
I am C# guy so I will write in C#. You can translate it into VB.NET lblEmailAdd.text = GetEmail(dropAssigned.SelectedValue) private String GetEmail(String memberID) { SqlCommand command = _Connection.CreateCommand(); String SQL = String.Format("SELECT EmailAdd from vwDepList where Member_ID = '{}'",memberID ); command.CommandText = SQL; command.CommandType = CommandType.Text; SqlDataAdapter adapter = new SqlDataAdapter(); adapter.SelectCommand = command; DataTable table = new DataTable() adapter.Fill(table); string email = (string)table.Rows[0]; return email. } Above _Connection is the SqlConnection to database. Hope that helps.