Use WebService to retrieve all mobile phone numbers from the home location

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.