Skip to content

Instantly share code, notes, and snippets.

View DDzia's full-sized avatar
:octocat:

Dziarkach Dzianis DDzia

:octocat:
  • Social Discovery Ventures
  • Belarus, Minsk
View GitHub Profile
@DDzia
DDzia / Startup.cs
Last active January 29, 2019 20:47
using System;
using System.Diagnostics;
using System.Linq;
using Microsoft.Owin;
using Owin;
[assembly: OwinStartup(typeof(WebApplication5.Startup))]
namespace WebApplication5
{
var conn = new SqlConnection("some connection string");
var db = new DatabaseContext(conn);
const string tableName = "dbo.tUsers";
var dataFound = db.QueryToTable(tableName)
.Where(x => (string)x["UserName"] == "Dzianis")
.ToList();
foreach (Row currentRow in rows)
{
//write the row start element with the attributes added above
_writer.WriteStartElement(currentRow);
foreach (OpenXmlElement currentCell in currentRow.ChildElements)
{
var cell = (Cell)currentCell;
//write the start of the cell element with the type and cell reference attributes