11
Answers

File Details from Directory and SQL Server

18Apr2016530PMAlpeshPandhidoc

Hi all...

I am not able to form the following logic ... Please help..

 

In Computer, I have many pdf files . Location - D:\\UploadedFiles

 

All file-names are unique - I have added Current DateTime as prefix for file Name.

String File = 18Apr2016530PMabcd.pdf

String dateTime = DateTime.UtcNow.Date.ToString("ddMMMyyyy") + DateTime.Now.ToShortTimeString();

String FileName = datetime + File;

----------------

SQL Server –

ColumnsNames

DataType

 

ID

Numeric(18,0)

PK ;Not Null; Auto increment

File Name

Varchar(500)

PK, Unique ; Not null

Status

bit

1-Active ; 0-InActive

Uploaded By

Numeric(18,0)

Not Null

Uploaded Date

Datetime

Not null (Default – Current Date)

----------------

On GridView,I want the output as follows –

FileName

UploadedBy

UploadedDate

 

 

18Apr2016530PMabcd.pdf

 

Sanjay.Sharma

1-JAN-2016

View

Delete

18Apr2016530PMWelfare.pdf

 

Mahesh.Bhatt

5-JAN-2016

View

Delete

 

Logic – I need to get list of files from path D:\\UploadedFiles

I need to check whether all file names are present in database or not.

If not, then I have to delete those records from the database.

Please guide…

 

Answers (11)