LiteDB - .Net, IOS, Android, Windows Phone
public class DataBase
{
[BsonId]
public string GetSetVariable { get; set; }
}
private void DisplayData_Load(object sender, EventArgs e)
{
using (var db = new LiteDatabase(@"C:\Temp\MyData.db"))
{
// Get a collection (or create, if doesn't exist)
var col = db.GetCollection<DataBase>("collection_name");
// Enter data into the database
var incomingData = new Database
{
GetSetvariable = "This is output text."
};
// Create unique index in Name field
col.EnsureIndex(x => x.GetSetVariable, true);
// Insert new customer document (Id will be auto-incremented)
col.Insert(incomingData);
// Update a document inside a collection
incomingData.GetSetVariable = "Updated Text Record";
col.Update(incomingData);
// Create a query
var results = col.FindAll();
// To display ALL columns of 'results' in a combo box.
foreach (var finding in results)
{
var variable = finding.GetSetVariable;
comboBox1.Items.Add(variable);
Console.WriteLine(variable);
}
// To display one record of 'results' to a text box.
var query = col.FindById(1);
var variable = query.GetSetVariable;
textBox1.Text = variable;
Console.WriteLine(variable);
}
}
SubClass 혹은 BaseClass 체크하기 ( System.Type ) (0) | 2018.09.06 |
---|---|
System.Obsolete 더이상 사용하지 않는 소스를 표시할때 (0) | 2018.09.06 |
대용량 텍스트 파일 읽기 (0) | 2018.07.04 |
C# 동적메모리 할당 (0) | 2018.07.04 |
[.Net 4.5] 2Gb 이상 메모리 사용 하기 (0) | 2018.07.03 |