Created
February 17, 2017 05:20
-
-
Save m8s00/337c6fa7626c1a793b0c3ed052aca855 to your computer and use it in GitHub Desktop.
C# DataTable Memo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DataTable dt = New DataTable(); | |
dt.Columns.Add("COL1"); | |
dt.Columns.Add("COL2", typeof(int), "Convert(COL1,'System.Int32')"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//filter | |
string sql = "SELECT COL1, COL2 FROM DUAL"; | |
DataTable dt = SelectSQL(sql); //Run SQL | |
DataRow[] dr = dt.Select("COL1='A'"); | |
//sort | |
DataRow[] dr2 = dt.Select("COL1='A'", "COL2 DESC"); | |
DataRow[] dr3 = dt.Select("COL1='A'", "COL2 ASC"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment