|
using MongoDB.Driver;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace AspWithMongo
{
public partial class Create : System.Web.UI.Page
{
string name = "";
protected void Page_Load(object sender, EventArgs e)
{
}
protected void showButton_Click(object sender, EventArgs e)
{
List<Info> names = new List<Info>();
MongoServer server = MongoServer.Create(ConfigurationManager.AppSettings["connectionString"]);
MongoDatabase myDB = server.GetDatabase("test");
MongoCollection<Info> Persons = myDB.GetCollection<Info>("persons");
foreach(Info Aperson in Persons.FindAll())
{
name = name+" "+Aperson.Name;
names.Add(Aperson);
}
nameLabel.Text = name;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.