Click here to Skip to main content
12,396,461 members (68,851 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: SQL-server-2005 C#2.0 C#3.0 C# , +
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.
Posted 4-Sep-12 6:21am
Comments
Member 7749624 4-Sep-12 12:23pm
   
This line " Console.WriteLine("bliisdsdsdszdsafsfdsF");" is a separator please don't consider this.
Akky
Wes Aday 4-Sep-12 12:27pm
   
Okay.... did you perhaps have some sort of specific question related to a specific programming problem or did you just want people to do your research for you? "I want" is not a question. 1. Okay so? Use a background thread and a progress bar. 2. So minimze your program to the tackbar. 3. Get your installation files and install the additional files for the text search capability.

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

SQL Server is not meant to be used in this way.

Try using lucene.net[^] or my article hOOt - full text search engine[^].
  Permalink  
Comments
Manas Bhardwaj 4-Sep-12 16:17pm
   
5ed!
Mehdi Gholam 5-Sep-12 1:25am
   
Thanks Manas!

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160721.1 | Last Updated 4 Sep 2012
Copyright © CodeProject, 1999-2016
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