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




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com