PDA

View Full Version : چگونه فایل پایگاه داده را از کنار برنامه فراخوانی کنیم؟



Rishter
یک شنبه 08 تیر 1393, 09:38 صبح
با عرض سلام و خسته نباشید

میخواستم بدونم چگونه فایل پایگاه داده رو از کنار برنامه فراخوانی کنیم؟؟ الان کد کانکشن من اینجوریه :


"Data Source=localhost;Initial Catalog=piza;Integrated Security=True"



چون میخواییم برنامه رو ببریم تو یه سیستم دیگه اجرا کنیم نیاز دارم که پایگاه داده رو از کنار برنامه فراخوانی کنیم که به مشکلی بر نخوریم .

a_mohammadi_m
سه شنبه 10 تیر 1393, 09:53 صبح
سلام
به این مثال نگاه کن
SqlConnection --->> Attach a database file on connect to a local SQL Server Express instance

Server=.\SQLExpress;AttachDbFilename=C:\MyFolder\M yDataFile.mdf;Database=dbname;Trusted_Connection=Y es;

Why is the Database parameter needed? If the named database have already been attached, SQL Server does not reattach it. It uses the attached database as the default for the connection.

مثالهای بیشتر در
http://www.connectionstrings.com/sql-server/