In a DNN 6.2.3 install, I need to retrieve the Value column data from the Lists table where the Text column equals the country's name and state's name variables I have created. I can successfully retrieve the Value column entry for one variable by doing the following:
Dim stateCodeQuery = String.Format("select Value from Lists where Text = '{0}'", userRegion)
Using dr As IDataReader = DataProvider.Instance().ExecuteSQL(stateCodeQuery)
While dr.Read
custState = Convert.ToString(dr(0))
End While
End Using
However, I want query the database such as:
Dim queryforBoth = String.Format("select value from Lists where Text = '{0}' or Text = '{1}', userRegion, userCountry)
The query above returns the Value column with two rows of data properly in SSMS, so I don't believe there is any error in the query. I believe I am unable to return multiple rows of data because I am creating an instance of IDataReader which only reads one row at the time. However, I cannot find an SQL querying method in the Dotnetnuke Dataprovider that will allow me to directly fill a datatable or otherwise return multiple rows of data. Furthermore, I could not identify a "GetLists" function of the Dotnetnuke Dataprovider that is able to return the "Value" of Lists per a match with the "Text" column. Any advise in regards to this issue would be greatly appreciated.