[dba-VB] How I'm approaching the problem

Charlotte Foust cfoust at infostatsystems.com
Thu Jul 19 14:01:11 CDT 2007


>>It has to be easy.

ROTFL  There's your problem, right there!!

Charlotte 

-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby
Sent: Thursday, July 19, 2007 11:42 AM
To: dba-vb at databaseadvisors.com
Subject: [dba-VB] How I'm approaching the problem

The problem with that is it takes a LOT of explaining to even get
started.

I am trying to develop a system where I can select a SQL Server instance
on the network.  Once I select a server, I need to select a database if
one exists, or build one if it does not exist.  Once I select (or build)
a database I need to select a table if one exists or build one if it
does not exist.  

Imagine the following scenario:

I have a directory of CSV files that I need to import into SQL Server.
I need to specify the server instance, the database, and a table into
which I want to import the data.  The server instance has to already
exist obviously.  However the database may or may not already exist.  I
need to select the server instance and create the db if none already
else select the db.  Either way I have then selected a db and then need
to see if a table exists, if not create it.  In the end select it.

So...

I have a form.  On the form I have:

1) A control to specify the path to the database files.
2) A control to select a server instance.
3) A control to select a database.
4) A control to select a table.

5) A control to specify a path to the DATA files to be imported.


#2 above needs code (and a combo as the control) to select the server.

#3 above needs code and a combo as the control to select a database
within that server

#4 above needs code and a combo to select a table within that database

1 and 5 already have controls and code to select a directory.

The entire form needs (already has as of today) code to store the
current settings as the form closes and read back out when the form
opens.

A byproduct of the way I work (I need to get real work done) is that I
often build systems like this bottom up instead of top down, though I
think top down.  Thus I build code that does the bottom piece, passing
in hard coded values for server / database / table and then come back
and either EDIT those values for the next set of data or BUILD the
pieces to select those data dynamically (where I am now).

So I have a program already in place that imports an entire directory of
CSV files into a server / database / table.  The server / database /
table pieces are passed in but hard coded in the form classes header.  

I am now trying to create the user interface to allow me to use controls
to browse the server / database / tables.  This seems like something
that .NET would just have as a class.  Dim a clsDBBrowser tree control
and click on the node, and back comes the values in a form that could be
used in an ADO connect string.  Given that I do not see that this is
true, I am building my own (not a tree control atm, but separate
combos).  A tree that looks identical to what already exists in SQL
Server (except with a server node) would be so much cleaner.

So there you have it, what I am trying to accomplish and how I am going
about it.  I have found code to obtain a server list and am working on
getting it functioning.  Why does it NEVER "just work"?  Once that is
working I have seen hints of code that obtains a list of databases in a
server, tables in a database etc.  I am working my way down the food
chain as we speak.  In each case except the server I need to be able to
"type in"
a value if I don't see what I need.  The database will just be created
(I have code to do that) but the table has to be created based on the
first row of a CSV file (I have code written to do that as well).  Bits
and pieces written, filling in the rest.  LOTS of work.

However once I get this finished, I will have a system where I can "find
/ describe" a server / database / table structure, specify where the
files come from and sit back as the files import.  I do this import on a
weekly basis, often more often than that.  It has to be easy.

John W. Colby
Colby Consulting
www.ColbyConsulting.com
-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte
Foust
Sent: Thursday, July 19, 2007 1:50 PM
To: dba-vb at databaseadvisors.com
Subject: Re: [dba-VB] VB.Net - Option Strict disallows implicit
conversion

Well, if you were REALLY lucky, you'd have someone saying "that works,
but I think I'd do it this way".  There isn't a single right way, there
are just more suitable ways for the present problem.  That's what can
get really maddening.  Of course you do have this list to play in, and
it might help others to see how you're approaching a problem too.

Charlotte 

_______________________________________________
dba-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com





More information about the dba-VB mailing list