Click here to Skip to main content
15,867,308 members
Articles / Database Development / SQL Server

Table Data Exporter

Rate me:
Please Sign up or sign in to vote.
4.58/5 (7 votes)
24 Jan 2008CPOL 33.3K   311   28   4
The Table Data Exporter creates a SQL script for data in a table.

ExportTable

Introduction

This application will let you script table data into a file. It will create an INSERT statement for each row in your table.

Using the code

The application is written in Visual Studio 2003, and has been tested with SQL Server only. Potentially, the application can work with other databases.

The application uses the DataLink object to connect to the database:

VB
Protected Function EditConnectionString(ByVal sConnectionString As String)
    Try
        Dim oDataLinks As Object = CreateObject("DataLinks")
        Dim cn As Object = CreateObject("ADODB.Connection")
        cn.ConnectionString = sConnectionString
        oDataLinks.hWnd = Me.Handle

        If Not oDataLinks.PromptEdit(cn) Then
            'User pressed cancel button
            Return ""
        End If

        cn.Open()
        Return cn.ConnectionString
    Catch ex As Exception
        MsgBox(ex.Message)
        Return ""
    End Try
End Function

License

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


Written By
Web Developer
United States United States
Igor is a business intelligence consultant working in Tampa, Florida. He has a BS in Finance from University of South Carolina and Masters in Information Management System from University of South Florida. He also has following professional certifications: MCSD, MCDBA, MCAD.

Comments and Discussions

 
QuestionHow to disable the provider Pin
Benosn Tan29-Jan-08 16:31
Benosn Tan29-Jan-08 16:31 
AnswerRe: How to disable the provider Pin
Igor Krupitsky31-Jan-08 12:03
mvaIgor Krupitsky31-Jan-08 12:03 
GeneralWorked great for me with SQL 2000 Pin
G James28-Jan-08 14:05
G James28-Jan-08 14:05 
GeneralRe: Worked great for me with SQL 2000 Pin
Josh Blair29-Jan-08 11:29
Josh Blair29-Jan-08 11:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.