Visual Basic Development Bookmark and Share   
 Home > Visual Basic General > Insert Into In External Database
 

Insert Into In External Database

I have the following Code, to insert all records of a tablefrom one database to a second database
        Dim sScrDb As String = "C:\CSystems\Data\Main.mdb"
        Dim sConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & sScrDb
        Dim sDstDb As String = "C:\CSystems\Projects\Data\Bck\BackUp.Mdb"
        Dim sSQL As String = "Insert Into Article IN '" & sDstDb & "' Select * From Article "
        Dim mConn As New OleDbConnection(sConn)
        mConn.Open()
        Dim mCom As New OleDbCommand(sSQL, mConn)
        mCom.ExecuteNonQuery()
        mConn.Close()
This is working fine, no problem.
But now I want to put a password on the second database. I can't find how to put this password in theSQL insert intostatement
Can somebody help me.


Best Regards
Vic
VsRex  Thursday, November 26, 2009 10:56 AM
I have the following Code, to insert all records of a tablefrom one database to a second database
        Dim sScrDb As String = "C:\CSystems\Data\Main.mdb"

        Dim sConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & sScrDb

        Dim sDstDb As String = "C:\CSystems\Projects\Data\Bck\BackUp.Mdb"

        Dim sSQL As String = "Insert Into Article IN '" & sDstDb & "' Select * From Article "

        Dim mConn As New OleDbConnection(sConn)

        mConn.Open()

        Dim mCom As New OleDbCommand(sSQL, mConn)

        mCom.ExecuteNonQuery()

        mConn.Close()

This is working fine, no problem.
But now I want to put a password on the second database. I can't find how to put this password in theSQL insert intostatement
Can somebody help me.


Best Regards
Vic

dig here please:

http://social.msdn.microsoft.com/Search/en-US?query=insert%20password&ac=3
Don't judge me, just Upgrade me. Thanks!
Malange  Thursday, November 26, 2009 6:46 PM
You can use ALTER DATABASE PASSWORD. See the below link for an example:

http://msdn.microsoft.com/en-us/library/aa139977(office.10).aspx#acadvsql_dbpword


Paul ~~~~ Microsoft MVP (Visual Basic)
Paul P Clement IV  16 hours 52 minutes ago

You can use google to search for other answers

Custom Search

More Threads

• Changing the font color by using the selection in a radio box at runtime
• Trying to Export a DataGridView that has no DataSet or DataSource(really)
• MS Access Email
• Strange/Truncated Return Value
• How to save and load user ordered columns in the datagridview-control?
• How to declare App.EXEName
• Forcing the regeneration of the designer.vb file programatically
• Can I open a form when all I have is the name as a string?
• Service runs as en-US, not en-GB!
• WebDisplay.DocumentComplete in Vista