What is the fastest way to insert values from datagridview to mysql database

前端 未结 3 1855
闹比i
闹比i 2021-01-16 23:51

I have a vb.net system and I want to insert 10,000 or more records from datagridview to mysql database. But it takes 8mins for 10,000 records when i tried this



        
3条回答
  •  孤独总比滥情好
    2021-01-17 00:25

    MySQL allows insert multiple set-of-rows in single insert command. Create a string in following formation:

    INSERT INTO yourTable(c1,c2,c3)
    VALUES (r1v1,r1v2,r1v3), (r2v1,r2v2,r2v3), (r3v1,r3v2,r3v3), . . . (rNv1,rNv2,rNv3)
    

    This command inserts multiple rows.

提交回复
热议问题