Skip to content

Instantly share code, notes, and snippets.

@sugimomoto
Created November 20, 2019 04:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sugimomoto/f137df6dbbfafd3d8b8386df076b359e to your computer and use it in GitHub Desktop.
Save sugimomoto/f137df6dbbfafd3d8b8386df076b359e to your computer and use it in GitHub Desktop.
DapperSample.CDataDriverSansan.cs
using Dapper;
using System;
using System.Data.CData.Sansan;
using System.Linq;
namespace DapperSample.CDataDriverSansan
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
string sqlBizCards = "SELECT * FROM BizCards";
using (var connection = new SansanConnection("APIKey=XXXXXXXXXX;range=me;"))
{
var bizcards = connection.Query<BizCard>(sqlBizCards).ToList();
Console.WriteLine(bizcards.Count);
foreach (var item in bizcards)
Console.WriteLine($"BizcardId: {item.BizcardId}; FirstName: {item.FirstName}; LastName: {item.LastName} ");
}
}
}
public class BizCard
{
public string BizcardId { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment