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...