Hey everyone!
I am trying to pull in data from table UD01 in c# that matches a certain criteria; Key1 =020817, and Key3 = 10. I can use BLTester on the server, and the adapter looks like this:
GetRows(String whereClauseUD01, String whereClauseUD01Attch, int32 pageSize, int32 absolutePage, out Boolean morePages)
I enter the following data into BLTester
WhereClauseUD01: (“Key1” = 020817 and “Key3” = 10)
WhereClauseUD01Attch:
pageSize: 0
absolutePage: 1
morePages: false
when using the adapter in c#, it looks like this:
/Ice.Lib.Searches.SearchOptions opts;
/System.Boolean& morePages;
/System.Data.DataSet dsUD01 = adapterUD01.GetRows(opts, out morePages);
I modified it to look like this:
/Ice.Lib.Searches.SearchOptions opts = new Ice.Lib.Searches.SearchOptions(SearchMode.AutoSearch);
/string whereClause = “(Key1 = 020817 and Key3 = 10)”;
/opts.NamedSearch.WhereClauses.Add(“UD01”,whereClause);
/bool morePages = false;
/adapterUD01.GetRows(opts,out morePages);
Is the above code correct? is that the best way to do this? I then try to look up the value Number01 using this code:
/EpiDataView edvPA2 = new EpiDataView();
/edvPA2.dataView = new DataView(adapterUD01.UD01Data.UD01);
/string cyct = Convert.ToString(edvPA2.dataView[edvPA2.Row][“Number01”]);
/MessageBox.Show(cyct);
I keep getting the following error:
Index -1 is either negative or above rows count.
What am I doing wrong? There is 1 record that matches this criteria. Thanks for the help!