2012-09-17 66 views
0

我有感應讀卡器,它給了我這樣的數據。這是我公司員工的數據。上傳記事本數據並插入SQL數據庫

010:0007739166:20120908:071009:BLANK !!:11 010:0013646521:20120908:073125:BLANK !!:11 010:0010840695:20120908:073129:BLANK !!:11 010:0005546931: 20120908:073131:BLANK !!:11 010:0013656129:20120908:073136:BLANK !!:11 010:0010827749:20120908:073222:BLANK !!:11 010:0009668536:20120908:073251:BLANK !!: 11 010:0009673161:20120908:073410:BLANK !!:11 010:0010822274:20120908:073421:BLANK !!:11 010:0005530871:20120908:073532:BLANK !!:11 010:0009299793:20120908: 073636:BLANK !!:11 010:0009679185:20120908:073638:BLANK !!:11 010:0002760233:20120908:073652:BLANK !!:11 010:0007740048:20120908:073703:BLANK !!:11 010:0009674566:20120908:073717:BLANK !!:11 010:0010844728:20120908:073727 :BLANK !!:11 010:0005545384:20120908:073742:BLANK !!:11 010:0010848020:20120908:073824:BLANK !!:11 010:0002008128:20120908:073857:BLANK !!:11 010 :0010826526:20120908:073903:BLANK !!:11 010:0007707930:20120908:073923:BLANK !!:11 010:0010844804:20120908:073927: !!:11 010:0009671072:20120908:073943:BLANK !!:11 010:0009293595:20120908:073958:BLANK !!:11 010 :0013653569:20120908:074001:BLANK !!:11 010:0009662322:20120908:074006: !!:11 010:0009667635:20120908:074015:BLANK !!:11 010:0010834564:20120908:074018:BLANK !!:11 010:0009680581:20120908:074023:BLANK !!:11

以前的第一件事:我不知道它是什麼。第二件事是員工證號碼。第三件事是日期,第四件事是時間。

我需要插入我的SQL數據庫表與這種類型的數據。我不知道如何插入它們。請幫幫我。 :)。感謝üguyz提前

回答

1

您可以使用SqlBulkInsert,以便插入您的DATAS

BULK INSERT 
    [ database_name . [ schema_name ] . | schema_name . ] [ table_name | view_name ] 
     FROM 'data_file' 
    [ WITH 
    ( 
    [ [ , ] BATCHSIZE = batch_size ] 
    [ [ , ] CHECK_CONSTRAINTS ] 
    [ [ , ] CODEPAGE = { 'ACP' | 'OEM' | 'RAW' | 'code_page' } ] 
    [ [ , ] DATAFILETYPE = 
     { 'char' | 'native'| 'widechar' | 'widenative' } ] 
    [ [ , ] FIELDTERMINATOR = 'field_terminator' ] 
    [ [ , ] FIRSTROW = first_row ] 
    [ [ , ] FIRE_TRIGGERS ] 
    [ [ , ] FORMATFILE = 'format_file_path' ] 
    [ [ , ] KEEPIDENTITY ] 
    [ [ , ] KEEPNULLS ] 
    [ [ , ] KILOBYTES_PER_BATCH = kilobytes_per_batch ] 
    [ [ , ] LASTROW = last_row ] 
    [ [ , ] MAXERRORS = max_errors ] 
    [ [ , ] ORDER ({ column [ ASC | DESC ] } [ ,...n ]) ] 
    [ [ , ] ROWS_PER_BATCH = rows_per_batch ] 
    [ [ , ] ROWTERMINATOR = 'row_terminator' ] 
    [ [ , ] TABLOCK ] 
    [ [ , ] ERRORFILE = 'file_name' ] 
    )] 

鏈接:http://msdn.microsoft.com/fr-fr/library/ms188365.aspx

+0

我'hhappy幫你Bappy –

相關問題