1
Answer

How to fetch data from mysql database in a specific way C# ?

armel djient

armel djient

8y
331
1
int rnber = 0; 
int rnber_last;
dchild = new DataTable();
string qrychild = "SELECT request_number,pincode,city WHERE request_number > '" + rnber + "' ;";

adap_child = new MySqlDataAdapter(qrychild, strcon);
adap_child.Fill(dchild);
rnber_last = Convert.ToInt32(dchild.AsEnumerable().Max(r => r["request_number"]));
rnber = rnber_last;hi all, i have winform visual studio 2012.

i hav a table "A" to which i want to fetch data in a specific way.
in fact when user opens the winform app on morning at 9 Am, i fetch from table A, data between day before night(10 pm) and current day 9Am. i save the last ID
Then after after each 2 hours, from the same table, i fetch data above last ID saved before (only data where id > previous id).
 
this is what i have tried so far
 

int rnber = 0; 
int rnber_last;
dchild = new DataTable();
string qrychild = "SELECT request_number,pincode,city WHERE request_number > '" + rnber + "' ;";

adap_child = new MySqlDataAdapter(qrychild, strcon);
adap_child.Fill(dchild);
rnber_last = Convert.ToInt32(dchild.AsEnumerable().Max(r => r["request_number"]));
rnber = rnber_last;

 
Answers (1)