Click here to Skip to main content

Akkywadhwa asked:

Open original thread
Class1:
 

 
public void getfol(string path)
        {
 
            SqlConnection conn = new SqlConnection("Data source=.;initial catalog=data_pc;integrated security=true");
           
            int i;
            try
            {
                string[] a = Directory.GetDirectories(path);
                for (i = 0; ; i++)
                {
                    SqlCommand cmd = new SqlCommand("insert into con values(@p)", conn);
                    cmd.Parameters.AddWithValue("@p", a[i]);
                    Console.WriteLine(a[i]);
 
                    bool isa = ((File.GetAttributes(a[i]) & FileAttributes.System) == FileAttributes.System);
                    if (isa == true)
                    {
                        SqlCommand md = new SqlCommand("insert into con values(@p)", conn);
                        md.Parameters.AddWithValue("@p", "next");
                        Console.WriteLine("bliisdsdsdszdsafsfdsF");
 
                        i++;
 
                    }
 
                    if (Directory.GetDirectories(a[i]).Length > 0)
                    {
 
                        getfol(a[i]);
 

                    }
 

                    if (Directory.GetFiles(a[i]).Length > 0)
                    {
                        getfil(a[i]);
 

                    }
 
                }
 
            }
 
            catch (Exception ec)
            {
                Console.WriteLine(ec.Message);
            }
        }
        public void getfil(String path)
        {
            SqlConnection conn = new SqlConnection("Data source=.;initial catalog=data_pc;integrated security=true");
 
            string[] p = Directory.GetFiles(path);
            for (int j = 0; j < p.Length; j++)
            {
                SqlCommand cmd = new SqlCommand("insert into con values(@p)", conn);
                cmd.Parameters.AddWithValue("@p", p[j]);
                conn.Open();
                cmd.ExecuteNonQuery();
                conn.Close();
                Console.WriteLine(p[j]);
            }
        }
 
    }
 

 

Program.cs
Class1 obj = new Class1();
            DriveInfo[] ab = DriveInfo.GetDrives();
            String str;
            for (int i = 0; i < ab.Length; i++)
            {
                str = ab[i].ToString();
                obj.getfol(str);
            }
            Console.ReadLine();
 

 
I wrote this program to retrieve all the contents of a hard disk in c# application. Now i want that it must be retrieve all contents on background and must show me a progress bar on a form. I want my application should run as background service i.e it must not be closed after pressing X on the form and must be minimized in the taskbar's left corner as in windows xp.
Additionly,It would be appreciable if any could tell me that how can i make this generated cache fulltext indexed in sql server 2005. I don't have the full text services installed so please provide me a link for downloading separate files for sql server 2005 to install freetext in it.
Regards,
Yours Sincerly,
Akky.
Tags: C# (C#1.0, C#2.0, C#3.0, C#4.0), .NET, Visual-Studio, SQL-server-2005

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the The Code Project Open License (CPOL).



Advertise | Privacy | Mobile
Web03 | 2.8.140827.1 | Last Updated 26 Mar 2009
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100