SunQuest
 
           .NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old November 9th, 2000, 09:28 AM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,578 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
How to compare strings in c#?

<i><b>Originally posted by : kamp (kamph@netease.com)</b></i><br /><br />i want compare user's password and the password from a database(m$sql), but it doesn't work!<br />when i print both two password on the web-browser, they are the same! The following is my code:<br /> <br /> SQLConnection myConnection = new SQLConnection("server=Qacomputer;uid=sa;pwd=;database=sn");<br /> SQLCommand myCommand = new SQLCommand("select psswrd from login where name='"+idname.SelectedItem.Value+"'", myConnection);<br /><br /> myConnection.Open();<br /> myCommand.Execute(out MyReader);<br /> MyReader.Read();<br /><br /> if(MyReader["psswrd"].ToString().Equals(password.Text.ToString()))<br /> hell.Text = "password is corrected";<br /> else<br /> hell.Text = "password is not corrected " +MyReader["psswrd"].ToString() + " " + password.Text.ToString();<br /> MyReader.Close();<br /> myConnection.Close();

Reply With Quote
  #2  
Old December 21st, 2000, 05:09 AM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,578 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
<i><b>Originally posted by : </b></i><br />hi<br />why do u want to do this ???<br />MyReader["psswrd"].ToString().Equals(password.Text.ToString())<br /><br />i guess ur storing strings of passwords into the database then why do you want to caste it back to a string(MyReader["psswrd"].ToString())<br />.Try using MyReader["psswrd"] only<br /><br />Regards<br />Saurabh<br /><br />------------<br />kamp at 11/9/2000 7:28:00 AM<br /><br /><br />i want compare user's password and the password from a database(m$sql), but it doesn't work!<br />when i print both two password on the web-browser, they are the same! The following is my code:<br /> <br /> SQLConnection myConnection = new SQLConnection("server=Qacomputer;uid=sa;pwd=;database=sn");<br /> SQLCommand myCommand = new SQLCommand("select psswrd from login where name='"+idname.SelectedItem.Value+"'", myConnection);<br /><br /> myConnection.Open();<br /> myCommand.Execute(out MyReader);<br /> MyReader.Read();<br /><br /> if(MyReader["psswrd"].ToString().Equals(password.Text.ToString()))<br /> hell.Text = "password is corrected";<br /> else<br /> hell.Text = "password is not corrected " +MyReader["psswrd"].ToString() + " " + password.Text.ToString();<br /> MyReader.Close();<br /> myConnection.Close();

Reply With Quote
Reply

Viewing: ASP Free ForumsProgramming.NET Development > How to compare strings in c#?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway