Click here to Skip to main content
15,879,535 members
Articles / Database Development / SQL Server

Generate SQL Select, Insert, Update and Delete

Rate me:
Please Sign up or sign in to vote.
2.93/5 (10 votes)
29 Nov 2006CPOL2 min read 138.4K   4K   55  
This will generate a SQL Select Query, Insert Query, Update Query and Delete Query by selecting SQL Database Connection and Choose a table to generate the script for using in class or DataCommand.
Public Class SetupDBForm

    Private Sub btnSetup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSetup.Click
        cdConn = New ConnectionData
        With cdConn
            .ServerName = txtServerName.Text
            .DatabaseName = txtDatabaseName.Text
            .UserID = txtUserID.Text
            .Password = txtPassword.Text
            If Not .CheckConnection() Then
                MsgBox("Connection Failed! Please check the setting.")
            Else
                MainForm.lblServerConf.Text = " DB: " & .ServerName & " - " & .DatabaseName
                Me.DialogResult = Windows.Forms.DialogResult.OK
                .SaveToRegistry()
            End If
        End With
        cdConn = Nothing
    End Sub

    Private Sub SetupDBForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        cdConn = New ConnectionData
        With cdConn
            .GetFromRegistry()
            txtServerName.Text = .ServerName
            txtDatabaseName.Text = .DatabaseName
            txtUserID.Text = .UserID
            txtPassword.Text = .Password
        End With
    End Sub
End Class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Indonesia Indonesia
Sam is working on .Net technologies for a reputed IT company

Comments and Discussions