Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Access a SQL database from a console application

Posted on 2012-04-09
1
Medium Priority
?
236 Views
Last Modified: 2012-04-10
I am trying to create a console application to run robocopy and copy a folder structure and still keep the permissions.

I have most of it working except for accessing the data for the new folder names.  Which can either reside in a sql database or in an access database.

Examples of how to get this working would be great.  here is what i have so far.

Module Module1

    Sub Main()

        Dim MyDatabase As OleDb.OleDbConnection
        Dim ConnectToMyDatabase As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
             "Data Source=\\SERVER\Database.mdb"
        MyDatabase = New OleDb.OleDbConnection(ConnectToMyDatabase)
        MyDatabase.Open()
        Dim stringx As String
        stringx = MyDatabase.Table

        Dim file As String
        file = "robocopy.exe"

        Dim args As String
        args = "C:\test C:\test2 *.* /copyall /mir"

        Dim username As String
        username = "Username"

        Dim pass As SecureString
        pass = Secure()

        Dim Dom As String
        Dom = "DOMAIN"
        Stop

        'Process.Start(file, args, username, pass, Dom)


    End Sub

    Public Function Start(fileName As String, arguments As String, userName As String, password As SecureString, domain As String) As Process
    End Function

    Public Function Secure() As SecureString
        Dim pass As String
        pass = "password"
        Dim str As New SecureString
        For x As Integer = 0 To pass.Length - 1
            str.AppendChar(pass.Substring(x, 1))
        Next

        Return str
    End Function

End Module

Open in new window

0
Comment
Question by:mjelec
[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
1 Comment
 
LVL 53

Accepted Solution

by:
Dhaest earned 1000 total points
ID: 37826709
Visual Basic 6 ADO Tutorial - reading mdb file
http://www.timesheetsmts.com/adotutorial.htm

 How to connect to a SQL server using Visual Basic 6.0
http://www.dreamincode.net/forums/topic/24677-connecting-to-a-sql-server-database-using-adodb/
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

670 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