Link to home
Start Free TrialLog in
Avatar of rmundkowsky
rmundkowskyFlag for Afghanistan

asked on

SQL to VB object

Hello,

I have a schema SQL (DDL).  It will likely change a lot (i.e. entities and relationships will be added and removed).  I am going to use the schema for a file structure definition and I would like to have a VB object/s created for interfacing the file.  Do you know of any quick ways to generate VB objects from a SQL definition?

E.g. SQL input:

CREATE TABLE A
 (ID NUMBER
 ,DATA VARCHAR2(4000)
 )

VB object output (A.cls file):

Private ID As Integer 'local copy
Private DATA As String 'local copy
Public Property Let time(ByVal _ID As integer)
    ID = _ID
End Property

Public Property Get ID() As Integer
    ID = ID
End Property

...
Avatar of leonstryker
leonstryker
Flag of United States of America image

If you are using SQL Server you can do this with DTS.  What is your database?

Leon
Avatar of rmundkowsky

ASKER

Actually, there is no database.  The data design was just done in a ER modeling tool.
The only way soemthing like this is possible is by launching another tool/process or something else, which is database specific.  So for example you may be able to execute xp_command_shell (or a similar system store proc) in Sybase or MS SQL Server, or you can utilize Perl/Java/VBScript ot whatever the database may support.  However, there is no direct way to "generate VB objects from a SQL".

Leon
Maybe I need to rephrase the question:

I want to create VB classes (source code), not objects (instants of classes) from SQL.
Give me an example of what it would look like if it waqs possible?  I am having a hard time visualizing this.

Leon
SQL INPUT:

         CREATE TABLE A (ID NUMBER ,DATA VARCHAR2(4000) )

VB CLASS OUTPUT:

         Private ID As Integer 'local copy
         Private DATA As String 'local copy

         Public Property Let time(ByVal _ID As integer)
             ID = _ID
         End Property

         Public Property Get ID() As Integer
             ID = ID
         End Property

         ....
Well, I guess you can create SQL code which will generate VB code and retrieve the result into a text file, but it will not be simple.

It seems to me that it would be easier to start in VB and have your code create a table in SQL Server and then create your class.

Leon
Yeah,

I think my current approach (below) is better.  

Have a Perl script to convert SQL to VB code.

Just thought someone might know of a tool that already does this.
ASKER CERTIFIED SOLUTION
Avatar of leonstryker
leonstryker
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial