C# veritabanı hatası

Kodla Büyü

ozkantas19

Site Gezgini
Mesajlar
63
c# ta sqlconnection ile veri tabanını bağlamaya kalktığımda "Error 26 locating server/instance specified"
hatası veriyor netten araştırdım ama bulamadım cevabını yardımcı olursanız sevinirim
 
Hocam code ile bağlandıysan connectionstringde bir problem olabilir.
yok sqldatasource ile bağlandıysan zannedersem sqlservr veya sqlwriter servislerinden biri çalışmıyor.
 
http://aquesthosting.com/SQLError26 bu siteden alıntıdır hocam:
Fix:
SQL Server 2000: Open the SQL Server Client Network Utility. On the General tab enable the protocols you need to use. Typically this will be 'TCP/IP' and possibly 'Named Pipes'.
SQL Server 2005 Open SQL Server Configuration Manager. Select "SQL Server 2005 Network Configuration | Protocols for MSSQLSERVER" then enable the protocols you need.
 
hocam ilginiz için teşekkür ederim
properties ten connectionstring ile bağlanmaya çalışıyorum ama olmuyor
erdcan hocam farklı bir bilgisayardaki veritabanına bağlanmaya çalışmıyorum ama
 
Hocam bide bunu deneyin
Cause: ASP.Net 2.0 Providers are trying to pull from the server's (nonexistent) Providers database.
By default the machine.config file is trying to pull the Provider information from a SQLExpress database using an invalid connection string named "LocalSQLServer". Many web servers will not have SQLExpress enabled, and will not have this value set to a valid SQL Server database that is of use to you. In a shared hosting environment, this is especially true, as it would be expected that you would want your Provider information stored in your database and not some single database shared by the other users of that web server.
Fix:
Since you probably cannot access the machine.config file, you need to override the Provider settings in your web.config file, and set the connection string name to your connection string name. The following code comes from the machine.config file and has been modified to first remove each provider before adding the provider.
Add the following code to your web.config file just under the "<system.web>" tag.
Make sure to replace the 3 occurrences of connectionStringName="LocalSQLServer" with your connection string name.
This goes in the system.web section of web.config.
<membership>
<providers>
<remove name="AspNetSqlMembershipProvider" />
<add name="AspNetSqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider,
System.Web, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="LocalSQLServer"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
applicationName="/"
requiresUniqueEmail="false"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="1"
passwordAttemptWindow="10"
passwordStrengthRegularExpression="" />
</providers>
</membership>
<profile>
<providers>
<remove name="AspNetSqlProfileProvider" />
<add name="AspNetSqlProfileProvider"
connectionStringName="LocalSQLServer"
applicationName="/"
type="System.Web.Profile.SqlProfileProvider,
System.Web, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</profile>
<roleManager>
<providers>
<remove name="AspNetSqlRoleProvider" />
<add name="AspNetSqlRoleProvider"
connectionStringName="LocalSQLServer"
applicationName="/"
type="System.Web.Security.SqlRoleProvider,
System.Web, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</roleManager>

Your database must be configured for the ASP.Net 2.0 Providers. This article assumes that you have already configured your database to use ASP.Net 2.0 Providers. If you haven't, there is an article at http://aquesthosting.com/ASPNetProvidersSQL2005.
 
hocam yalnız ben c# başlayalı bi kaç gün oldu yazdıklarınızdan pek fazla bişey anlamadım sorunumu açayım isterseniz;
sqlconnection ekledim sayfaya propertiesten connectionstring new conecction diyip sql server da hazırladığım veritabanını gösteriyorum test dediğim zamn yazdığım hatayı veriyo
 
hocam daha çaıklayıcı olsun istedim kusra bakmayın çok yeni olduğum için yapamıyorum eminim çok küçük ve basit bir hata yapıyorumdur
 

Ekli dosyalar

  • ekran.JPG
    ekran.JPG
    113.2 KB · Görüntüleme: 962
Tam emin değilim ama bunun nedeni Sql server içerisinde remote connection izni verilmediğinden kaynaklanabilir. Bu sorun olup olmadığını test etmek için yukarıdaki resimde görülen formdaki Test Connection butonuna tıklayın. Eğer hata veriyorsa bu izni vermek içn Başlat / Programlar / Microsoft SQL Server 2008 / Configuration Tools / SQL Server Configuration Manager aracını açarak eğer Sql Server Browser çalışma modunda (Running) değilse bunu çalışma moduna getirmeniz gerekir.
 
BBNET
Geri
Üst