Opened 5 years ago
Closed 5 years ago
#2453 closed enhancement (fixed)
Simpler code for returning results to a DataTable
| Reported by: | Kay Kittell | Owned by: | Kay Kittell |
|---|---|---|---|
| Priority: | medium | Milestone: | Server 2.2.2 |
| Component: | Public Website 2 | Version: | N/A |
| Severity: | Keywords: | ||
| Cc: | Database Engine: | N/A | |
| Operating System: | N/A |
Description
Instead of having to do code like this every time you query the database:
using (SecureData sd = new SecureData(true, UserManager.GetLoginToken(true)))
{
_dt = sd.GetData("web_searchcriteria_item_list_2", "", 0, 0).Tablesweb_searchcriteria_item_list_2;
}
I started using methods with overflows in taxonomy called "Return results." This then calls the above, or one for dm.read, depending on your needs. Since it was much easier to code dt = ReturnResults(..), than the above every time (I'd often mess up changing the 2nd table table and get an error), ReturnResults should go in Utils.cs and not taxonUtil.cs
Change History (4)
comment:1 by , 5 years ago
comment:2 by , 5 years ago
| Status: | assigned → addressed |
|---|
comment:3 by , 5 years ago
| Summary: | Easier way to get results in c# → Simpler code for returning results to a DataTable |
|---|
comment:4 by , 5 years ago
| Component: | Other → Public Website 2 |
|---|---|
| Resolution: | → fixed |
| Status: | addressed → closed |
Utils.cs has code for reusing throughout the PW.

created in Utils.cs:
public static DataTable ReturnResults(String dataview, string ids)
public static DataTable ReturnResults(string sql, DataParameters dp)
public static DataTable ReturnResults(string strSQL)
To make querying databases simpler code.