Click here to Skip to main content
15,907,493 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
if (dirinfo.exists)
  //{
  //    filesinthisfolder = dirinfo.getfiles().count();
  //}
  //if (includesubfolders)
  //{
  //    //filesinthisfolder += dirinfo.getdirectories().sum(di => button1_click(di));
  //    //return filesinthisfolder;
  //}
         
 FileInfo[] filearr = dirinfo.GetFiles();

 foreach (FileInfo f1 in filearr)
 {
   for (int i = 0; i < 1; i++)
   {
     SqlConnection conn = new SqlConnection();

     string name = f1.Name;
     conn = new SqlConnection(ConfigurationManager.ConnectionStrings["sqlCon"].ToString());//Sql database connection written in web.config file
     conn.Open();
     SqlCommand cmd;
     try
     {
     }
Posted
Updated 11-May-15 20:43pm
v2
Comments
Sergey Alexandrovich Kryukov 12-May-15 2:19am    
This "code" won't even compile. Please remove/edit it, ask a correct question.
—SA
Sinisa Hajnal 12-May-15 2:38am    
It seems you already got the file list. What is the problem? The question is totally unclear and the code shows noting. What do you want to do?
Member 11527624 12-May-15 3:45am    
I am actually selecting the directory and i am capturing the directory information like Directory path,Directoryname,etc (directory id is primary key).Now i want to read the list of files in the directory with the file size,path,name and store it in the filestable(directory id is foreing key) database...Please provide me with some code...

1 solution

May be below link full fill your requirement
https://msdn.microsoft.com/en-us/library/k3352a4t(v=vs.110).aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900