this is a sql statement that i m trying to use in a Window application in .NET.
<pre>string selCmd = "SELECT eInfo.EmpID, eInfo.Name, lInfo.LeaveEnteredOn, lInfo.LeaveFrom, lInfo.LeaveTo, lInfo.LeaveType" +
"FROM lmsEmpInfo AS eInfo INNER JOIN lmsLeaveInfo AS lInfo ON lInfo.EmpID = eInfo.EmpID" +
"WHERE (lInfo.LeaveGranted = 0)";</pre>
the problem is this query works fine when i m running it on the SQL server management studio, but gives an error of "Incorrect syntax near AS", when i try to execute it with the following code:
SqlDataAdapter myAd = new SqlDataAdapter();
SqlConnection myCon = new SqlConnection();
DataSet myDs = new DataSet();
myCon.ConnectionString = Properties.Settings.Default.LeaveMgmtConnectionString.ToString();
myAd.SelectCommand = new SqlCommand(selCmd, myCon);
Please help me to rectify this mistake......... I would also like to have suggestions on
How can i change the entire row collection of a DataGridView with the SelectedIndexChange event of a combobox and that too according to query that is being fired at the same event
any help or assistance is greatly appreciated!!