SQLite database Query Batch

Source: Internet
Author: User
Tags sqlite sqlite database

Mining web site, the Web site changes every day, and the database has thousands of data, through the Select COUNT (*) to find the database there is no such URL, do not have to collect storage, so if the Web page update 1000 connections, the acquisition will be select COUNT (*) 1000 times, 1 times Select COUNT (*) to compare thousands of data in the database, so the speed is slow, like in the code below the cmdlist. ADD ("update newsandnotice Set id =" + i + "where ID =" + newsid[i] + ";"); method, once all query statements are added to the array, one-time query, once back to the results of each query!

            //string SQL = "SELECT count (*) from News where ss= ' web address '"; //list<string> NewsID = sql_hp. Sql_column (SQL);List<string> cmdlist =Newlist<string>(); Cmdlist. ADD ("BEGIN;");  for(inti =0; i < Newsid.count; i++) {cmdlist. ADD ("Update News Set ID ="+ i +"WHERE ID ="+ Newsid[i] +";"); } cmdlist. ADD ("COMMIT;"); SQL_HP.        Sql_insert (cmdlist);  Public intSql_insert (list<string>Cmd) {intTempint =0;  while(!Connopen ()) Thread.Sleep ( -); Sqlitecommand Command=NewSqlitecommand ("", conn); foreach(stringIinchCmd.toarray ()) {Command.commandtext=i; Try{command.                ExecuteNonQuery (); }                Catch{}} command.            Dispose ();            Connclose (); returnTempint; }

SQLite database Query Batch

Related Article

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.