Exemplo n.º 1
0
        private void deleteTable(SqlClient sqlClient, string name)
        {
            string sqlCommand = "DROP TABLE " + name;

            try { sqlClient.ExecuteNonQueryCommand(sqlCommand); }
            catch { }
        }
Exemplo n.º 2
0
        private void createDefaultTable(string testTable, List <ColumnMetadata> metadata)
        {
            SqlClient sqlClient = getClient() as SqlClient;

            deleteTable(sqlClient, testTable);

            string sqlCommand;

            sqlCommand = "CREATE TABLE " + testTable + " (";
            foreach (ColumnMetadata cmd in metadata)
            {
                sqlCommand += "[" + cmd.Fieldname + "] [" + cmd.Typename + "]" + cmd.Size + " ";
                if (!cmd.IsNullable)
                {
                    sqlCommand += "NOT NULL";
                }
                sqlCommand += ",";
            }
            sqlCommand += ")";

            sqlClient.ExecuteNonQueryCommand(sqlCommand);
        }