سلام به دوستان عزیز،
من با Entity Framework Code First می خوام یک جدول درست کنم ولی با این Error روبرو میشم:
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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)<c#>
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; //using System.Data.Entity; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Ef_3_09 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void btnAddSomeNewCountries_Click(object sender, EventArgs e) { Models.DatabaseContext ODataBaseContext = new Models.DatabaseContext(); Models.Country Cun = new Models.Country(); try { Cun.Name = "iran"; ODataBaseContext.Countries.Add(Cun); ODataBaseContext.SaveChanges(); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } finally { } } } }
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> </configSections> <connectionStrings> <add name="DatabaseContext" connectionString="Data Source=.; Initial Catalog=Country; Integrated Security=true;" providerName="System.Data.SqlClient" /> </connectionStrings> <entityFramework> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> <parameters> <parameter value="mssqllocaldb" /> </parameters> </defaultConnectionFactory> <providers> <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> </providers> </entityFramework> </configuration>
این پست در تاریخ {{ dateString(new Date(post.deleteDate)) }} توسط {{ post.deletedByUser }} حذف شده است.
دلیل حذف: {{ post.deleteReason ?? 'نامشخص' }}
زمان پاسخ گویی روز های شنبه الی چهارشنبه ساعت 9 الی 18
فقط به موضوعات مربوط به محصولات آموزشی و فروش پاسخ داده می شود