Error 3 Cannot implicitly convert type 'string' to 'bool'

I am trying to setup a select statment to either select by data or not select by date if the user leaves the date fields blank.  I am using an if statment on the date field but keep getting the above error message.  Can someone tell me what I am missing.

Here is my code:
-------------------------------------------------------------------------

protected SqlDataAdapter CreateDRRAdapter()
        {

           
            SqlConnection conn = new SqlConnection(ConnString);
            SqlCommand cmd = new SqlCommand(SearchString, conn);

            tbName.Text = tbName.Text + "%";


            cmd.Parameters.Add(new SqlParameter("@DRR1", tbName.Text));
            cmd.Parameters.Add(new SqlParameter("@DOCUMENTID", tbDocumentId.Text));
            cmd.Parameters.Add(new SqlParameter("@USERNAME", tbDocCreatedBy.Text));
            cmd.Parameters.Add(new SqlParameter("@FROMDATE", datechooseFrom.Text));
            cmd.Parameters.Add(new SqlParameter("@TODATE", datechooserTo.Text));
         
            SqlDataAdapter sqlDA = new SqlDataAdapter(cmd);
            return sqlDA;
        }

        //------------   Search Tab
        private String ConnString
        {
            get
            {
                //ConnectionString comes from the Web.Config
                return ConfigurationManager.ConnectionStrings["213123ConnectionString"].ConnectionString;

            }
        }

        //------------   Search Tab
        private String SearchString
        {
            get
            {


                if (datechooseFrom.Text != "")
                {

                    String srchCmd = "SELECT DRRPHI.DOCUMENTID, DRRPHI.MODIFIEDDATE, DRRPHI.USERNAME, DRRPHI.DRR1 FROM DRRPHI WHERE DRRPHI.DOCUMENTID = @DOCUMENTID OR DRRPHI.MODIFIEDDATE >= @FROMDATE OR DRRPHI.MODIFIEDDATE <= @TODATE OR DRRPHI.DRR1 like @DRR1";
                    return srchCmd;
                }


                if (datechooseFrom.Text = "")   -----------------  Error occurs here and not on the above IF statment.
                {

                    String srchCmd = "SELECT DRRPHI.DOCUMENTID, DRRPHI.MODIFIEDDATE, DRRPHI.USERNAME, DRRPHI.DRR1 FROM DRRPHI WHERE DRRPHI.DOCUMENTID = @DOCUMENTID OR DRRPHI.DRR1 like @DRR1";
                    return srchCmd;
                }



            }
        }
kwh3856OwnerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

tiagosalgadoCommented:
In C# to compare any type of variable you need to use "==" instead of "=". So, your if need to be like "if (datechooseFrom.Text == "") ".
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kwh3856OwnerAuthor Commented:
Thank you.  I always forget that.

Thanks
Kenny
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.