Apr 18, 2011

ConnectionString ထဲက instance name

sagaing
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

ဒီ Error က ASP.Net(C#) က‌နေ SQL Server ကိုလှမ်းချိတ်တဲ့အခါမှာ  SQL Server ရဲ့ instance name ကို ASP.Net(C#) ကရှာ မ‌တွေတဲ့ အချိန်မှာဖြစ်တတ်တဲ့ Error ပါ။

Web.config ဖိုင်ထဲမှ SQL Server Connection String
    <connectionStrings>
        <add name="myConnection" connectionString="server=mySQLServer; Database=HiStock;UID=myuser1;PWD=user1pwd;Connection Timeout=60;" providerName="System.Data.SqlClient"/>
    </connectionStrings>



အခု ကျွန်‌တော့်ရဲ့ Web.config ဖိုင်ထဲမှာ server=mySQLServer ဆိုပြီးတော့ သုံးထားပါတယ်။   mySQLServer ဆိုတာ instance name ပါ။  ကိုယ်‌ပေးချင်တဲ့ name ‌ပေးလို့ရပါတယ်။  အဲ့လို mySQLServer ကိုသုံးနိုင်ဖို့ရန်အတွက် SQL Server တင်ထားတဲ့ စက်ရဲ့ Control Panel > Administrative Tools > Data Sources (ODBC) ထဲမှာ System DSN တစ်ခု Add... လုပ်‌ပေးထားဖို့ လိုပါတယ် name က‌တော့ mySQLServer ဆိုတဲ့ နာမည်နဲ့‌ပေါ့... အဲ့လိုမှ မဟုတ်ဘူး ဆိုရင်‌တော့ server=SQL Server name ဒါမှမဟုတ် SQL Server ရဲ့ IP Address တစ်ခုခု ထည့်‌ပေးရပါတယ်...အဲ့ဒီ instance name သတ်မှတ်ချက်ဟာ တစ်ခုခု လွဲမှား‌နေပြီဆိုရင် အထက်မှာ ‌ဖေါ်ပြထားတဲ့ error တက်‌တော့တာပါပဲ...

အထက်ပါ Error နှင့်ပတ်သတ်ပြီး အခြားသူများရဲ့ ဖြေရှင်းနည်းများကိုလည်း ‌အောက်ပါ Links များမှာ သွား‌ရောက် ‌လေ့လာနိုင်ပါတယ်...

http://blog.sqlauthority.com/2009/05/21/sql-server-fix-error-provider-named-pipes-provider-error-40-could-not-open-a-connection-to-sql-server-microsoft-sql-server-error/

http://www.sqlmusings.com/2009/03/11/resolving-a-network-related-or-instance-specific-error-occurred-while-establishing-a-connection-to-sql-server/

ကိုစစ်ကိုင်း

မှတ်စုရေးသူအကြောင်း

sagaing / Software Engineer

နာမည်အရင်းမှာ လှိုင်မင်းထက်ဖြစ်ပြီး၊ ကိုစစ်ကိုင်းဆိုသည့် နာမည်ပြောင်နှင့် မိတ်ဆွေ၊ သူငယ်ချင်းများက ရင်းနှီးစွာခေါ်ကြပါသည်။ ယခင်ကမြန်မာနိုင်ငံတွင် သင်ကြားရေး နှင့် Software Development လုပ်ငန်းများတွင် ဝင်ရောက်လုပ်ကိုင်ခဲ့ပြီး၊ ယခုလက်ရှိမှာ စင်ကာပူနိုင်ငံရှိ နည်းပညာကုမ္ပဏီတစ်ခုတွင် ဝင်ရောက်လုပ်ကိုင်နေပါသည်။

0 ခုမှတ်ချက်ပေးထားတယ်။:

Post a Comment

ကိုစစ်ကိုင်း၏ မှတ်စုများ. Powered by Blogger.