Results 1 to 23 of 23

Thread: Need help with restoring the data using store procedure [resolved]

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2004
    Posts
    610

    Resolved Need help with restoring the data using store procedure [resolved]

    hey guyz.. i will bold the line that crashed.. it crashed when i was adding the parameters in the vb.net section
    just in case i will post the stored procedure part alos

    this is the vbcode i used

    VB Code:
    1. Dim myconnection As New SqlConnection(myConnectString)
    2.  
    3.         myconnection.ConnectionString = myConnectString
    4.  
    5.         myCommand = New SqlCommand("spRestoreDatabase", myconnection)
    6.  
    7.         myconnection.Open()
    8.         myCommand.CommandType = CommandType.StoredProcedure
    9.  
    10.        [b] myCommand.Parameters.Add(New SqlParameter("@Name", RestoreName, "@Path", RestorePath))[/b]
    11.  
    12.         myCommand.ExecuteNonQuery()
    13.  
    14.         MsgBox("Data Restored")
    15.         myconnection.Close()

    This is the stored procedure that i used

    VB Code:
    1. Create Procedure spRestoreDatabase
    2. @Name as VARCHAR(1000),
    3. @Path as VARCHAR(1000)
    4.  
    5. As
    6.  
    7. Restore Database @Name
    8. From Disk = @Path
    9. GO
    Last edited by ryanlum; Mar 5th, 2005 at 10:24 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width