Auto-generate VB.NET forms using SQL Server 2008

I want to automatically generate VB.NET forms using tables from a SQL Server database (one form / database table). It is perhaps possible with writing custom custom code for it, but if there is already some feature that does the job that would be great (database has 40+ tables, manually doing this is a tedious task).

Any answers, help, links, tips is greatly appreciated.

  • Sequential Group By in sql server
  • How to use a TRIM function in SQL Server
  • Quickest way to clone row in SQL
  • SQL Query to identify records applicable for a distinct set of data
  • SQL Server 2008 R2 - How to filter a group of records with conditional logic?
  • Occasionally Getting SqlException: Timeout expired
  • Regards,
    Ayub

  • Design pattern to convert tree-rules from Weka into SQL query
  • Convert tabular data to XML using SQL Server
  • Inserting Records From Csv File To Database Table (SQL Server)
  • How to display arabic characters in web page using php and sql server
  • Convert EF-based app to multi-tenant by way of context overrides
  • How to import a files like PDF MP3 DOC XLS into a MS SQL Server Datatable field using VBA code in Access2007
  • One Solution collect form web for “Auto-generate VB.NET forms using SQL Server 2008”

    It takes just a minute to fix, all functionality allready exists in Visual Studio.

    Fire up Visual Studio, click on Add new datasource… to start the Data Source Configuration Wizard:

    enter image description here

    Select Database and follow the wizard:
    enter image description here

    When connected to the database, select the tables you are interrested in and press the Finnish button:
    enter image description here

    Now, this will create a strongly named dataset in your solution, if you double click the xsd file you’ll see the tables you selected in the schema editor, but leave that for now:
    enter image description here

    Now, select “Show Data Sources” from the data-menu and you will see all tables you selected in the wizard. To the left of each field its an icon that tells what type of control that field will be represented by on the resulting form:

    enter image description here

    Now you can deside how the data will be presented on the form, as a datagridview or in detail mode, just use the dropdown on the table name (only when in form-design-mode).

    enter image description here

    If you have selected details-mode on the table, then you can change what control the field will be represented by (must be in form-design-mode, not code-mode):

    enter image description here

    Then just drag the table from the data source view to an empty form and it will magically create controls to edit/add/delete and move around the data.

    This is the result if DataGridView-mode was selected:

    enter image description here

    And if Details was selected on the table:

    enter image description here

    In code behind it also magically add some code to load the data to the adapter when the form loads and some save/validating code:

    Private Sub AccountBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AccountBindingNavigatorSaveItem.Click
        Me.Validate()
        Me.AccountBindingSource.EndEdit()
        Me.AccountTableAdapter.Update(Me.MyDBDataSet.Account)
    
    End Sub
    
    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'MyDBDataSet.Account' table. You can move, or remove it, as needed.
        Me.AccountTableAdapter.Fill(Me.MyDBDataSet.Account)
    
    End Sub
    
    MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.