Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Noker Lodia
  Where is Noker Lodia?
 irvine
 California - United States
 Noker Lodia
 To: nyron williams
  Where is nyron williams?
 Kingston
 Jamaica
 nyron williams
 Tags
Subject: RE: How to programmatically attach a database to a server
Thread ID: 104185 Message ID: 104191 # Views: 5 # Ratings: 0
Version: Visual FoxPro 9 Category: Databases, Tables and SQL Server
Date: Sunday, August 13, 2006 12:04:28 AM         
   


> hello everyone, i was wondering if anyone knows how to programmatically attach the mdf & ldf files for a database to an insatance os ms sql server.
>
> thanks in advance!


I think this is what you are looking for:
oMyobject = CreateObject('SQLDMO.SQLServer')
oMyobject.LoginSecure = .T.
oMyObject.Connect([Server Name])
oMyObject.AttachDBWithSingleFile([DataBase Name])

(Assuming SQL Server has already been installed)

Noker Lodia
The interesting thing about life is that we all have our own contradictions.

Noker Lodia
The interesting thing about life is that we all have our own contradictions.

ENTIRE THREAD

How to programmatically attach a database to a server Posted by nyron williams @ 8/12/2006 6:16:14 PM
RE: How to programmatically attach a database to a server Posted by Noker Lodia @ 8/13/2006 12:04:28 AM