Okay, this is probably a stupid question, but I can't find the answer anywhere, so I'm going to ask anyway. I'm new to VB .Net (and visual studio), so please forgive me in advance.
I have the following module in my application:
I also have a start up screen form with 2 radio buttons. One button leads to a "Create Database Snapshot" form and the other leads to a "Create Database Backup" form. If I choose one (doesn't matter which), the secondary form pops up and the operation concludes succesfully. I can then close the secondary form with the upper right X and see the startup form again. If I then try to chose the other secondary form, it gives me the "Object reference not set to an instance of an object" error.
In the top of both secondary forms, I'm calling the connection with "CreateMyConnection()". I figure this is where I'm going wrong, because Visual Studio seems to think I'm trying to reset the connection objects, when I'm really not.
How can I call the Connection stuff again so it doesn't matter which form I choose, it'll still maintain the same Server information?
Thanks,
Catadmin - MCDBA, MCSA
"No, no. Yes. No, I tried that. Yes, both ways. No, I don't know. No again. Are there any more questions?"
-- Xena, "Been There, Done That"
I have the following module in my application:
Code:
Imports Microsoft.SqlServer.Management.Smo
Imports Microsoft.SqlServer.Management.Common
Imports System.Data.SqlClient
Module CreateInitialConnection
Public ProdServer As New Server()
Public ProdConn As ServerConnection
Public Sub CreateMyConnection()
ProdConn = ProdServer.ConnectionContext
ProdConn.ServerInstance = "Z0185DBS0310V3, 1433"
End Sub
End Module
I also have a start up screen form with 2 radio buttons. One button leads to a "Create Database Snapshot" form and the other leads to a "Create Database Backup" form. If I choose one (doesn't matter which), the secondary form pops up and the operation concludes succesfully. I can then close the secondary form with the upper right X and see the startup form again. If I then try to chose the other secondary form, it gives me the "Object reference not set to an instance of an object" error.
In the top of both secondary forms, I'm calling the connection with "CreateMyConnection()". I figure this is where I'm going wrong, because Visual Studio seems to think I'm trying to reset the connection objects, when I'm really not.
How can I call the Connection stuff again so it doesn't matter which form I choose, it'll still maintain the same Server information?
Thanks,
Catadmin - MCDBA, MCSA
"No, no. Yes. No, I tried that. Yes, both ways. No, I don't know. No again. Are there any more questions?"
-- Xena, "Been There, Done That"