Skip to content

Instantly share code, notes, and snippets.

@iJungleboy
iJungleboy / DNN-PetaPoco-Razor-Demo
Created May 12, 2014 19:41
Blog Demo using PetaPoco in Razor with DNN to access SQL data
@functions
{
// for PetaPoco you must first create a class containing the fields you want
private class fileRecord
{
public int FileId {get;set;}
public string FileName { get; set; }
public int Size { get; set; }
public int FolderId { get; set; }
}
@iJungleboy
iJungleboy / DNN-DataTable-Razor
Created May 12, 2014 19:35
Blog - Demo how to use a DataTable in Razor
@using System.Configuration
@using System.Data
@using System.Data.SqlClient
@{
var conString = ConfigurationManager.ConnectionStrings[Content.ConnectionName].ToString();
var sqlCommand = "Select Top 10 * from Files Where PortalId = @PortalId";
var adapter = new SqlDataAdapter(sqlCommand, conString);
adapter.SelectCommand.Parameters.Add("@PortalId", Dnn.Portal.PortalId);
var fileTable = new DataTable();
adapter.Fill(fileTable);
@iJungleboy
iJungleboy / DNN-DataReader-Razor
Last active August 29, 2015 14:01
Blog Demo showing how to use DataReader in Razor
@using System.Configuration
@using System.Data.SqlClient
@{
var conString = ConfigurationManager.ConnectionStrings[Content.ConnectionName].ToString();
var con = new SqlConnection(conString);
con.Open();
var command = new SqlCommand("Select Top 10 * from Files Where PortalId = @PortalId", con);
command.Parameters.Add("@PortalId", Dnn.Portal.PortalId);
SqlDataReader myReader = command.ExecuteReader();
}
@iJungleboy
iJungleboy / 0_reuse_code.js
Created April 22, 2014 12:34
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console