Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7708399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:36:10+00:00 2026-06-01T00:36:10+00:00

I am using the code below t programmatically restore a SQL database using VB.Net

  • 0

I am using the code below t programmatically restore a SQL database using VB.Net

        Dim srvConn2 As New ServerConnection(strDataSource)
        srvConn2.LoginSecure = False
        srvConn2.Login = strDBUserID
        srvConn2.Password = strDBPassword
        Dim srv3 As New Server(srvConn2)
        Dim res As Restore = New Restore()

        If OpenFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
          res.Devices.AddDevice(OpenFileDialog1.FileName, DeviceType.File)
          res.Database = "MyDatabaseName"
          res.ReplaceDatabase = True
          res.SqlRestore(srv3)
          MsgBox("Restore Complete", vbInformation)
        End If

This works fine when the backup file is located on the same machine where the database is running. Problems start when the database is on another machine on the network. Is there some way to make the OpenFileDialog show the data structure of the remote machine so that the DB backup file can be loaded from there? SQL Management studio does show the remote file structure when you try to manually restore a database. I was wondering if there is a control similar to the one that comes up on SQL Management Studio.

If this cannot be done, is there any way to make remote SQL server restore database from a file on the local machine? I would rather not use shared network drives or UNC paths since this should be as easy as possible and I don’t want to have users having to play around with sharing and stuff.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T00:36:11+00:00Added an answer on June 1, 2026 at 12:36 am

    Your first case is when your code runs locally and the SQL is remote and backup is remote. There’s no standard control for browsing the files on remote server, but if you have sufficient rights, you can access the remote file system through SQL’s xp_cmdshell command (link). You can write your own control utilizing xp_cmdshell to look similar to the OpenFileDialog.

    Your second case is when backup is local. There’s absolutely no way SQL can access it without you providing a correct UNC path.

    A workaround could be to allow user to select a local file, then (without user knowing) the program would upload this file to a predetermined location on the remote SQL server and SQL restores it from that location.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to access an SQLite 3 database programmatically using the code below:
I am using the code below to validate integers and floats in ASP.NET, but
I am using the code below to save and restore the window position and
Using the code below, I am attempting to fill a Canvas with UIElements and
Using the code below (from a console app I've cobbled together), I add seven
Using the code below, I want to keep the same menu div opened in
Using the code below I'm expecting a green rectangle and a red one of
i am using this code below to dynamically capture the name of the button
I am using the code below to replace text inside a div. But I
I am using the code below to change to shape of the winform. It's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.