?
Solved

SQL to VB object

Posted on 2004-08-23
9
Medium Priority
?
193 Views
Last Modified: 2010-08-05
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

...
0
Comment
Question by:rmundkowsky
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 29

Expert Comment

by:leonstryker
ID: 11892714
If you are using SQL Server you can do this with DTS.  What is your database?

Leon
0
 

Author Comment

by:rmundkowsky
ID: 11923353
Actually, there is no database.  The data design was just done in a ER modeling tool.
0
 
LVL 29

Expert Comment

by:leonstryker
ID: 11926957
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
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:rmundkowsky
ID: 11933352
Maybe I need to rephrase the question:

I want to create VB classes (source code), not objects (instants of classes) from SQL.
0
 
LVL 29

Expert Comment

by:leonstryker
ID: 11933937
Give me an example of what it would look like if it waqs possible?  I am having a hard time visualizing this.

Leon
0
 

Author Comment

by:rmundkowsky
ID: 11934093
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

         ....
0
 
LVL 29

Expert Comment

by:leonstryker
ID: 11934251
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
0
 

Author Comment

by:rmundkowsky
ID: 11934763
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.
0
 
LVL 29

Accepted Solution

by:
leonstryker earned 1050 total points
ID: 11935748
Well, you are using the same method as i suggested above, just that you are starting from Perl instead of VB.  I am pretty sure that no such tool exists.

Leon
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month9 days, 11 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question