-
-
Save lethern/89aba870db64413220bf0cfd8d1f6bd9 to your computer and use it in GitHub Desktop.
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
public object getTablesSchema(int a) | |
{ | |
using (SqlConnection conn = getConnection("")) | |
return getTablesSchema_impl(conn); | |
} | |
public object getTablesSchema_customDB(string db_name) | |
{ | |
try { | |
using (SqlConnection conn = getConnection_custom(db_name)) | |
return getTablesSchema_impl(conn); | |
} | |
catch (Exception e) { | |
throw; | |
} | |
} | |
private object getTablesSchema_impl(SqlConnection conn) | |
{ | |
using (SqlCommand command = new SqlCommand("", conn)) | |
{ | |
conn.Open(); | |
command.CommandText = "SELECT table_name" + | |
" FROM INFORMATION_SCHEMA.TABLES" + | |
" order by table_name"; | |
return UtilsDB.getResults_ext(command); | |
} | |
} | |
public static List<string> getResults_listSingleStr(SqlCommand command) | |
{ | |
using (SqlDataReader reader = command.ExecuteReader()) | |
{ | |
return getResults_listSingleStr_impl(reader); | |
} | |
} | |
private static List<string> getResults_listSingleStr_impl(SqlDataReader reader) | |
{ | |
List<string> result = new List<string>(); | |
while (reader.Read()) | |
{ | |
result.Add(dbObjToStr(reader.GetValue(0))); | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment