SQL Query for Login Page
===

When a user login with his Vendor_ID and password, he will redirect to 2 different pages based upon the conditions. If he already register in the site and his registration is approved by the web admin, he will redirect to 'RegPage1.aspx' otherwise to 'ApprovalStatus.aspx'. If the user enter the wrong Vendor_ID or Password it will throw the error message as 'Enter valid VendorID or Password'. So i wrote the C# code like below. **It works fine** but anyone can help me to simply this by merge the two SQL queries, check the vendor_ID availabilty in 'User_Info' table and ApprovalStatus check in 'Company_Info' table ?
 
        protected void BtnHomeUserSubmit_Click(object sender, EventArgs e)
        {            
        SqlConnection SqlCon = new SqlConnection(GetConnectionString());  
        try      
        {             
          if ((txtHomeUsername.Text == "") || (txtHomePassword.Text == ""))        
          {               
            ScriptManager.RegisterStartupScript(this, this.GetType(), "Alert", "alert ('Enter valid  VendorID or Password');", true); 
          }             
          else           
          {       
             var da1 = new SqlDataAdapter("select * from User_Info where Vendor_ID='" +  txtHomeUsername.Text.Trim() + "'", SqlCon);                
            var dt1 = new DataTable();          
            da1.Fill(dt1);         
            if (dt1.Rows.Count > 0)        
            {            
             var da2 = new SqlDataAdapter("select * from Company_Info where Approval_Status='NO' AND Vendor_ID='" + txtHomeUsername.Text.Trim() + "'", SqlCon);        
                  var dt2 = new DataTable();    
                  da2.Fill(dt2);            
 
             if (dt2.Rows.Count > 0)       
             {            
               string url = "ApprovalStatus.aspx";     
               ClientScript.RegisterStartupScript(this.GetType(), "callfunction", "alert('Your Vendor ID is already registered');window.location.href = '" + url + "';", true);  
             }        
             else          
             {                      
                 Response.Redirect("RegPage1.aspx?Parameter=" + Server.UrlEncode (txtHomeUsername.Text));        
             }       
         }          
           ScriptManager.RegisterStartupScript(this, this.GetType(), "Alert", "alert('Enter valid  VendorID or Password');", true);     
             }      
        }       
       finally   
       {      
        SqlCon.Close();    
       }       
       } 
