views:

43

answers:

1

Hi there... I am creating a desktop application in C# where my code is :

 private void btnLogin_Click(object sender, EventArgs e)
        {
            if (clsFunctions.recordExist("SELECT AtNumConstructorID, TxtConstructorName AS Fullname FROM tblConstructorDetails WHERE txtUserName = '" + txtUserName.Text + "' AND TxtPassword LIKE '" + txtPassword.Text + "' ", "tblConstructorDetails") == true)
            {
                clsVariables._sTimeLogin = DateTime.Now.ToLongTimeString();//recording the time of login in the CES
                long totalRow = 0;
                //Set the Data Adapter
                OleDbDataAdapter da = new OleDbDataAdapter("select AtNumConstructorID, TxtConstructorName AS Fullname, tblConstructorDetails.txtUserName FROM tblConstructorDetails WHERE txtUserName =" + txtUserName.Text, clsConnections._olbedbCN);
                DataSet ds = new DataSet(); // creating a dataset to enter the values in the dataadapter
                da.Fill(ds, "tblConstructorDetails");
                totalRow = ds.Tables["tblConstructorDetails"].Rows.Count - 1;
                clsVariables._sContId = Convert.ToInt32(ds.Tables["tblConstructorDetails"].Rows[0].ItemArray.GetValue(0));
                clsVariables._sConstructor = ds.Tables["tblConstructorDetails"].Rows[0].ItemArray.GetValue(1).ToString();
                clsVariables._sUserID = ds.Tables["tblConstructorDetails"].Rows[0].ItemArray.GetValue(2).ToString();
                clsUserLogs.RecordLogin(clsVariables._sTimeLogin, clsVariables._sContId);
                clsApplication._boolAPP_CONNECTED = true;
                this.Close();

            }
        }

Note : clsFunctions : A class where all the common functions are written recordexist : function, which returns true if a record is available.

For recordexist, I am providing a query. the data from the textbox is not be transferred to the query and i can make out, why it is happening... Please help SOS...

A: 

If you want to make the password case insensitive use this:

UPPER(TxtPassword) = UPPER('" + txtPassword.Text + "') "

Ignore below did not see it was not a webapp

The problem must be in the you aspx page or how you reference that page. Please post the aspx too.

My guess is you are not hooking the event in right or not declaring txtUserName right.

Hogan
It's a desktop application, so basically the problem must be that he's referencing the wrong text boxes (or that nothing has been entered)
klausbyskov
@klausbyskov : what would be possible solution to do that?>???
sohil vohra
@sohil : there is no way to know without seeing the rest of your code for the form.
Hogan