Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Attaching A SQL Database Using Visual Basic

Status
Not open for further replies.
May 1, 2003
13
US
I wrote a program that dettaches our month end database on Friday night and should attach it back again on Saturday morning. The dettaching works just fine but attaching does not work. Any ideas?
Dim oSQLSrv As New SQLDMO.SQLServer
FileName1 = .mdf filename
FileName2 = .ldf filename
oSQLSrv.Connect SQLServerName, SQLUserID, SQLPwd
oSQLSrv.AttachDB sDBName, FileName1 & ", " & FileName2
oSQLSrv.DisConnect
Set oSQLSrv = Nothing
 
Why are you detaching and reattaching the database. Perhaps there is a better way to get the effect that you are looking for.

Denny

--Anything is possible. All it takes is a little research. (Me)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top