if you have an SQL table like:
Table1
int id
varchar text
make a class
class Table1
{
int id;
String text;
getId();
getText();
void selectRow(int id)
{
SQLConnection sql = new SQLConnection("connectionString");
string query = "select * from Table1 where id= "+id.ToString();
if(read)
{
this.id = ???
this.text = ???
}
static List<Table1> selectAll()
{
List<Table1> list = new List<Table>();
SQLConnection sql = new SQLConnection("connectionString");
string query = "select * from Table1";
Table1 tmp;
while(read)
{
tmp= new Table1();
tmp.id = ???
tmp.text = ???
list.Add(tmp);
}
}
}
form:
init()
{
listview.AddColumn("id",50);
listview.AddColumn("text",100);
}
fillListView()
{
List<Table1> tList = new List<Table1>();
tlist = Table1.selectAll();
}