Esempio n. 1
0
        private IAsyncCollector <string> BuildJsonCollector(SQLDatabaseAttribute attribute)
        {
            var connectionString = attribute.ConnectionString;;
            var tableName        = attribute.TableName;

            return(new SQLDatabaseAsyncJsonCollector(connectionString, tableName));
        }
Esempio n. 2
0
        // All {} and %% in the Attribute have been resolved by now.
        private DataTable BuildItemFromAttr(SQLDatabaseAttribute attribute)
        {
            string connStr   = attribute.ConnectionString;
            string tableName = attribute.TableName;
            string sqlQuery  = attribute.SQLQuery;

            using (SqlConnection conn = new SqlConnection(connStr))
            {
                conn.Open();

                DataTable table = new DataTable();

                using (SqlCommand cmd = new SqlCommand(sqlQuery, conn))
                {
                    SqlDataAdapter da = new SqlDataAdapter(cmd);
                    da.Fill(table);
                }

                conn.Close();

                return(table);
            }
        }