Java databases import Excel data

Source: Internet
Author: User

Importing data will divide the table into XLS and xlsx two formats, there are many cases online

1, the data in the Excel data table is incomplete, the database is a required option;---start with the SQL statement: Determine if there are any changes to the statement

  //set an optional field plus a required fieldString optionals="hospital_id"; String biyou= map.Get("biyou") ; String Optionalval= Datautil.addfieldblank (biyou) +","; if(Map.Get("Birthdate"). ToString (). Length () >0) {optionals+=", Birthdate"; Optionalval+=datautil.addfieldbraces (map.Get("Birthdate")) +","; }         if(Map.Get("Visit_time"). ToString (). Length () >0) {optionals+=", Visit_time"; Optionalval+=datautil.addfieldbraces (map.Get("Visit_time")) +","; } String visit_id= map.Get("visit_id") ==NULL?""'": string.valueof (map.Get("visit_id")); String SQL="INSERT into Medical_record ("+ Optionals +", CID"+", Doctor_code"+") VALUES ("        //+Optionalval+ Datautil.addfieldblank (map.Get("CID")) +","+ Datautil.addfieldblank (Diagnosis) +","+Datautil.addfieldblank (doctor_name)+")"; returnUpdate (SQL, map);
AQL

2, import Excel table digital data garbled---for the number (because the Excel digital limit length in scientific way to express the reason)

A, the text format to convert batch to numeric format, the steps are: Enter 1 in the blank cell, right-click the cell, copy, and then select the text type number area, right click, "paste" note check "multiply".

Detailed operation See figure

b, click to select the entire column, the data----------Next-----Next------Select the text, then click Finish

Java databases import Excel data

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.