Wednesday, March 21, 2012

HOW CAN I ATTACH DATABASE TO MSDE ?

I am having little problem with it , I am using installshield for setup program and at the end when I finish with msde installation I try to attach a database, I would like to use SQL-DMO , but I dont have much clue how can I do it I need some examples sc
ripts
Thanks a lot
While you can use SQL DMO, it's really easier to simply use ADO or ADO.NET.
When you "open" a database connection against SQL Server and point to the
MDF file, ADO does an attach for you (unless the database is already
attached). This code is from a yet-to-be-published article on SQL Server
Express where I attach a new database to the local SQLEXPRESS named
instance.
Try
cn = New SqlConnection("Data Source=.\SQLExpress;" _
& "Integrated Security=True;Database=Biblio;" _
& "Timeout=60;" _
& "Application Name=SQLExpress Test;" _
& "AttachDBFilename=" & strFn)
da = New SqlDataAdapter("SELECT AU_ID, Author, Year_Born from
authors", cn)
ds = New DataSet
da.Fill(ds)
DataGridView1.DataSource = ds.Tables(0)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
hth
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
"Robert" <Robert @.discussions.microsoft.com> wrote in message
news:1F642E5F-37AB-4BA7-88DF-5159C607AA0C@.microsoft.com...
> I am having little problem with it , I am using installshield for setup
program and at the end when I finish with msde installation I try to attach
a database, I would like to use SQL-DMO , but I dont have much clue how can
I do it I need some examples scripts
> Thanks a lot
>
|||Hello Robert.
U have said th@. u installed MSDE 2000 using installsheild. How did u do this. Pls help me as im unable to install MSDE itself. Also its givin me a message a strong SA id and password is required.
"Robert" wrote:

> I am having little problem with it , I am using installshield for setup program and at the end when I finish with msde installation I try to attach a database, I would like to use SQL-DMO , but I dont have much clue how can I do it I need some examples
scripts
> Thanks a lot
>

No comments:

Post a Comment