Add a webservicereference for http://api.showji.com/locating/mobile.asmx
Using system;
Using system. Collections. Generic;
Using system. text;
Using system. Threading;
Using system. Data;
Using system. Data. SQLite;
Namespace getmobiledata
{
Class getdata
{
Publicvoid get ()
{
For (INT I = 0; I <= 9; I ++)
{
New thread (New parameterizedthreadstart (getthread). Start (I );
}
// List <mobileinfo> minfos = new list <mobileinfo> ();
}
Privatevoid getthread (Object OBJ)
{
Int nmobilebase = 1300001;
Int noffset = 1300000;
Int I = (INT) OBJ;
Nmobilebase + = I * 10000;
Noffset + = I * 10000 + 9999;
For (Int J = nmobilebase; j <noffset; j ++)
{
Mobileinfo minfo = new mobileinfo ();
Minfo. mobilecode = J. tostring ();
Mobileservice. Mobile mobilesrv = new mobileservice. Mobile ();
Console. writeline ("querying" + J );
Mobilesrv. query (J. tostring () + 1234, out minfo. province, out minfo. city, out minfo. areacode, out minfo. postcode, out minfo. corpname, out minfo. cardname );
Console. writeline ("saving" + J );
Savetodb (minfo );
}
}
Privatevoid savetodb (mobileinfo minfo)
{
Sqliteconnection liteconn = new sqliteconnection ("Data Source = E: \ utildata \ mobile; version = 3; new = true ;");
Liteconn. open ();
String ssql = "insert into m_mobile_data (cmobilecode, cprovince, cCity, careacode, cpostcode, ccorpname, ccardname)" +
"Values (@ mobilecode, @ province, @ city, @ areacode, @ postcode, @ corpname, @ cardname )";
Sqlitecommand litecmd = new sqlitecommand (liteconn );
Litecmd. commandtext = ssql;
// Litecmd. parameters.
Sqliteparameter litepara = new sqliteparameter ();
Litepara. parametername = "mobilecode ";
Litepara. dbtype = dbtype. String;
Litepara. value = minfo. mobilecode;
Litecmd. Parameters. Add (litepara );
Litepara = new sqliteparameter ();
Litepara. parametername = "Province ";
Litepara. dbtype = dbtype. String;
Litepara. value = minfo. province;
Litecmd. Parameters. Add (litepara );
Litepara = new sqliteparameter ();
Litepara. parametername = "city ";
Litepara. dbtype = dbtype. String;
Litepara. value = minfo. City;
Litecmd. Parameters. Add (litepara );
Litepara = new sqliteparameter ();
Litepara. parametername = "areacode ";
Litepara. dbtype = dbtype. String;
Litepara. value = minfo. areacode;
Litecmd. Parameters. Add (litepara );
Litepara = new sqliteparameter ();
Litepara. parametername = "postcode ";
Litepara. dbtype = dbtype. String;
Litepara. value = minfo. postcode;
Litecmd. Parameters. Add (litepara );
Litepara = new sqliteparameter ();
Litepara. parametername = "corpname ";
Litepara. dbtype = dbtype. String;
Litepara. value = minfo. corpname;
Litecmd. Parameters. Add (litepara );
Litepara = new sqliteparameter ();
Litepara. parametername = "cardname ";
Litepara. dbtype = dbtype. String;
Litepara. value = minfo. cardname;
Litecmd. Parameters. Add (litepara );
Litecmd. executenonquery ();
Liteconn. Close ();
}
}
Class mobileinfo
{
Publicstring mobilecode;
Publicstring province;
Publicstring city;
Publicstring areacode;
Publicstring postcode;
Publicstring corpname;
Publicstring cardname;
}
}
Application on PSP
Therefore, SQLite is used.
With 10 threads enabled, We will temporarily run segments 130 to 139