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