I am using linqtoexcel for my automation project. This file contains different site URL and its credentails. If I use only one row I am able to login to that site. But if there are two rows then I am having problem in using where clause.
Please help if you can if you do not understood anything please ask question.
Below is my code.
string pathfile = @"..\..\Data.xlsx"; string sheetName = "Login"; var excelFile = new ExcelQueryFactory(pathfile); var abc = from a in excelFile.Worksheet(sheetName).AsEnumerable() where Row.Field<String>("ID").Trim() == "2" select a; PropertiesCollection.driver.Manage().Window.Maximize(); foreach (var a in abc) { PropertiesCollection.driver.Navigate().GoToUrl(a["URL"]); } foreach (var a in abc) { objLogin.Login(a["uname"], a["paswd"]); }
I know I am wrong as per my code. Also I know, I have an error in Field<String>
Please guide what will the better way to use where clause in linqtoexcel.