.NETGURU
Form Variables
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngbeta' list.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

Dennis Liaw
What is wrong with this?

I have a simple Login form that contains Name & Pswd boxes,
on PostBack, I will verify them against the DB.
This is the line that failed:
        String sSQL = "SELECT * From authors where au_lname = '" +
frmRegister.txtName.Text + "' And au_fname = '" +
frmRegister.txtPassword.Text + "'";

It will work if I hard coded to
String sSQL = "SELECT * From authors where au_lname = 'Liaw' And au_fname =
'Dennis'";

Thanks a lot!

Code: ====================================
if(IsPostBack){
if(Page.IsValid) {
        string scn = "server=localhost;uid=sa;pwd=;database=pubs";
        String sSQL = "SELECT * From authors where au_lname = '" +
frmRegister.txtName.Text + "' And au_fname = '" +
frmRegister.txtPassword.Text + "'";
        //String sSQL = "SELECT * From authors where au_lname = 'Liaw' And
au_fname = 'Dennis'";
        SQLConnection myCn = new SQLConnection(scn);
        SQLDataSetCommand cmd = new SQLDataSetCommand(sSQL, myCn);

Reply to this message...
 
    
Ron0079@aol.com
In a message dated 5/10/2001 5:28:10 PM Pacific Daylight Time,
Click here to reveal e-mail address writes:

<< String sSQL = "SELECT * From authors where au_lname = '" +
frmRegister.txtName.Text + "' And au_fname = '" +
frmRegister.txtPassword.Text + "'"; >>

Shouldn't that be:
"Select * From authors where au_lname = '" + txtName.Text + "' And au_fname =
'" + txtPassword.Text + "'";

?

ron

Reply to this message...
 
    
Das (VIP)
[Original message clipped]

Daniel --

why are you trying to access the control by preceding
with the form name. you can simply access as

txtName.text and txtPassword.Text

Thanks,
DAS.

--- Dennis Liaw <Click here to reveal e-mail address> wrote:
[Original message clipped]


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

Reply to this message...
 
 
System.Web.UI.Page




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification