abdujalil  chuliev

abdujalil chuliev

  • 1.2k
  • 400
  • 38.9k

loop folder get and insert doc file to sql db one by one

Sep 28 2017 1:57 AM
I need help. I have to insert doc files into mssql with their folder names using c#.
 
Here are some example directories:
\gpvmsrv01\INPUT\Scan\Patent\2017\2\I AP 20170115\Formula\1.doc \gpvmsrv01\INPUT\Scan\Patent\2016\1\I AP 20160248\Description\2_u.doc
And the number of files are more than thousand.
Table name: patent
 
[app_number] [int] NOT NULL,
[type] [nchar](20) NULL,
[filename] [nchar](10) NULL,
[data] [varbinary](max) NULL,
 
I should iterate through all directories.
 
SO my first row values
 
app_number=20170115 type=Formula filename=1 data=1.doc file
 
My second row values
 
app_number=20160248 type=Description filename=2_u data=2_u.doc file
 
I would be very grateful if someone helps me with some example code, please.

Answers (1)