The compiler likes the second "==" but not the first "==" 'says Expression expected
If (email == txtEmailAddress And password == txtPassword) Then On Mar 31, 12:49 pm, "Stephen Russell" <[email protected]> wrote: > == instead of = > > ......................... > Stephen Russell - > Senior Visual Studio Developer, DBA > > Memphis, TN > 901.246-0159 > > > > > -----Original Message----- > > From: [email protected] > > [mailto:[email protected]] On Behalf Of Brock > > Sent: Tuesday, March 31, 2009 10:55 AM > > To: DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web > > Services,.NET Remoting > > Subject: [DotNetDevelopment] querying XML for user login > > > I'm trying to use an XML file like below for users to login to my > > website. I have some code started below, but I'm sure there's a better > > way. "(email = txtEmailAddress And password = txtPassword)" does not > > compile. > > > <?xml version="1.0" standalone="yes"?> > > <members> > > <member> > > <firstName>Ralph</firstName> > > <lastName>Ward</lastName> > > <emailAddress>[email protected]</emailAddress> > > <password>1920</password> > > </member> > > </members> > > > Private Sub btnLogin_Click(ByVal sender As System.Object, _ > > ByVal e As System.EventArgs) Handles btnLogin.Click > > > Dim ds As DataSet = New DataSet > > ds.ReadXml(MapPath("members.xml")) > > Dim email As String = "" > > Dim password As String = "" > > > If ds.Tables(0).Rows.Count > 0 Then > > email = ds.Tables(0).Rows(0)("EmailAddress").ToString() > > password = ds.Tables(0).Rows(0)("Password").ToString() > > End If > > > If (email = txtEmailAddress And password = txtPassword) Then > > lblLoginFailure.Visible = True > > lblLoginFailure.Text = "Welcome to Our Site." > > Else > > lblLoginFailure.Visible = True > > lblLoginFailure.Text = "Email Address and/or Password are > > incorrect. Please try again." > > End If > > End Sub > > > No virus found in this incoming message. > > Checked by AVG -www.avg.com > > Version: 8.0.238 / Virus Database: 270.11.31/2029 - Release Date: > > 03/31/09 06:02:00- Hide quoted text - > > - Show quoted text -
