using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WhitePage.Data;
namespace TestDbfRecord
{
class Program
{
static void Main(string[] args)
{
//USING MEMO (DBT) and ForEach
//create table
List<DbFieldInfo> fields = new List<DbFieldInfo>();
DbFieldInfo field = new DbFieldInfo();
field.Name = "nickname";
field.Type = 'C';
field.Len = 100;
fields.Add(field);
field = new DbFieldInfo();
field.Name = "note";
field.Type = 'M';
fields.Add(field);
string file = AppDomain.CurrentDomain.BaseDirectory +"\\demo.dbf";
using (DbfRecordset rs = DbfRecordset.Create(file, fields))
{
Random ran = new Random(1000);
int recCount = 10;
for (int i = 1; i <= recCount; i++)
{
int id = ran.Next(0,1000);
string nick = "Jon ID :" + id.ToString();
System.Diagnostics.Debug.Print(nick);
rs.AddNew(); // append black
rs["nickname"] = nick;
rs["note"] = @"
fsog[apiofsdug[ opiug oiuergpo
e prioue[u[etguo[ieutg[oitroieutoi ogjdf;lkjg;lkdsf
dsopfgih[posdi h[podigh[psodgih
sdgoih[posdgihpo";
rs.Update(); // commit changes
}
rs.ForEach(r =>
{
System.Diagnostics.Debug.Print(rs["nickname"].ToString());
System.Diagnostics.Debug.Print(rs["note"].ToString());
return true;
});
rs.Close();
}
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WhitePage.Data;
namespace TestDbfRecord
{
class Program
{
static void Main(string[] args)
{
//USING MEMO (DBT) and ForEach
//create table
List<DbFieldInfo> fields = new List<DbFieldInfo>();
DbFieldInfo field = new DbFieldInfo();
field.Name = "nickname";
field.Type = 'C';
field.Len = 100;
fields.Add(field);
field = new DbFieldInfo();
field.Name = "note";
field.Type = 'M';
fields.Add(field);
string file = AppDomain.CurrentDomain.BaseDirectory +"\\demo.dbf";
using (DbfRecordset rs = DbfRecordset.Create(file, fields))
{
Random ran = new Random(1000);
int recCount = 10;
for (int i = 1; i <= recCount; i++)
{
int id = ran.Next(0,1000);
string nick = "Jon ID :" + id.ToString();
System.Diagnostics.Debug.Print(nick);
rs.AddNew(); // append black
rs["nickname"] = nick;
rs["note"] = @"
fsog[apiofsdug[ opiug oiuergpo
e prioue[u[etguo[ieutg[oitroieutoi ogjdf;lkjg;lkdsf
dsopfgih[posdi h[podigh[psodgih
sdgoih[posdgihpo";
rs.Update(); // commit changes
}
rs.ForEach(r =>
{
System.Diagnostics.Debug.Print(rs["nickname"].ToString());
System.Diagnostics.Debug.Print(rs["note"].ToString());
return true;
});
rs.Close();
}
}
}
}
Комментариев нет:
Отправить комментарий