Firstly, I'd like to compliment you on a very well articulated
question.

There are a couple of points that I'd like to make regarding your
scenario.

1. You managed to get me googling for and subsequently reading up on
Cathy. The application I use personally as my disk indexer is IFNS
(http://www.sowsoft.com/file-name-search.htm). IFNS also provides
instant searchability across all drives as well as the ability to
create multiple databases. It uses an MS Access DB to maintain the
index. I myself have often given thought to building a Quick-searcher
application that would quickly search my disks for the file I want.
The biggest problem with file indexers is that they quickly grow out
of date, which is why I want to build an app that searches the disk
(not a semi-obsolete catalog) but does it in the fastest way possible.
Windows file indexers circumvent this problem by constantly running
the indexing as a background service.

2. The application you build using C# will certainly not be as fast or
compact as the C/C++ application. The .NET Framework exposes classes
such as the FileInfo, DirectoryInfo and FileSystemInfo (abstract base
class of the previous two) in the System.IO namespace which internally
call into the Win32 API to do the work. Of course, it would be quite
easy to handle Unicode, flexible search options and Regex based
searches in C#. So, you need to decide if high performance is your
foremost priority.

3. The usual way to dynamically create a SQL Server database from code
is to create an SqlConnection to the "Master" database and execute a
"CREATE DATABASE..." query. A very simplistic example is presented
here:

http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q307283

As a matter of principle, I do not like to build ad-hoc SQL strings
like this. Even if it were for my own use, I would simply create an
Stored Procedure in the Master database and invoke that.

LINQ also provides dynamic database creation via the
DataContext.CreateDatabase() method. But you would require either
declarative or external file mapping to create the database schema.

So, the first thing you should do is decide upon the database you want
to use. When I build apps for my own use, MS Access seems a very
attractive option.

4. There appears to be ample information on the web regarding dynamic
DB creation. It appears that you might not be searching with the right
keywords. Please note that searching with the keyword "create database
VC#" will bring your far less relevant results than simply with
"create database C#" because the majority of the industry refers to
the language simply as "C#". As a side point, when I need language
independent results, I usually use an OR operator in my googling
("create database C# OR VB.NET").

5. I'm not very clear about just how comfortable you are working with
the .NET framework. I don't think you need a book to build this kind
of application. You could read a book on ADO.NET and one on Windows
forms apps to build your concepts, but I would not recommend it unless
you intend to move into the .NET domain professionally. A couple of
online tutorials should get you going as far as I can tell.

I'd be glad to provide any guidance I can, so don't hesitate to let me
know if you need more information.

On Jun 14, 5:44 pm, tonysin <[email protected]> wrote:
> I need someone to point me in the right direction.  i'll give a few
> paragraphs of background, but if you just want the question, skip down
> to "HERE IS THE QUESTION:"
>
> I was a C programmer in scientific apps before I retired.  I'm now
> puttering around with Visual C#.  So I know how to program, but I'm a
> little shaky with OOP, and I'm clueless with databases.
>
> There is a freeware disk cataloger called Cathy that I have used for
> many years.  It's small and fast.  You give it a starting point, e.g.
> folder, drive, CD, etc., and it very quickly builds a database of the
> files from there down, recursing through all the subdirectories.  You
> do that with as many drives or CDs as you want, and you end up with a
> bunch of little databases, one for each drive (or CD or any
> combination).  Then when you want to know where a particular jpg file
> is, you just type in part of the name, and Cathy almost instantly
> finds every file on every drive that matches the string.  I have
> dozens of drives with several terabytes of data in millions of files,
> and a search only takes a second.  Rebuilding the catalog of a system
> partition can take a minute, though.
>
> So, I love Cathy, but it's a bit dated, and its limits are beginning
> to be a problem.  The big problem is it's not unicode, and I have a
> lot of files and folders with Asian characters that it can't handle
> correctly.  I'd also like more flexibility in the search, e.g.ranges
> on the date and size, and regex in the search string.  So I want to
> write a windows forms app that does all that, just for my use (unless
> Bill G calls and offers me a million bucks).
>
> HERE IS THE QUESTION: What is the best way to create and access
> databases in a VC# program?  By best, I mean reasonably fast,
> reasonably easy to program, and it's all done within my VC# forms app,
> i.e. I don't build the DB in SQLServer or something and then use VC#
> to query, I do EVERYTHING in VC#.
>
> I have been googling around, and there are all kinds of sites that
> talk about database programming with C#, but they all seem to have
> different approaches.  There is ADO, LINQ, SQL Server, etc.  I looked
> at some books in the bookstore, but I couldn't find one that showed
> how to create databases programmatically within VC#.  Half of them had
> you type the data in yourself, and the other half had you use
> SQLServer or something to create the DB, and then use VC# to query it.
>
> I don't want to do either of those.  I want to programatically recurse
> through my folders and enter every file I find into a DB, from within
> the VC# app.  Then I want to be able to enter a search string and some
> date and size ranges, and see all the files that match.
>
> If someone could tell me generally how to do that, I can probably find
> a book to get the details.  If someone could point me to a website
> that talks about it, even better.
>
> Thanks for any help.

Reply via email to