2012-11-12 66 views
1

我有代碼優先ADS11連接字符串的問題,代碼優先數據庫服務器11連接字符串

我已經嘗試了很多方法,但我無法做到。

有人知道,請指教我。

這是我的工作環境。


服務器:利用數據庫服務器11

路徑:\ ADS_DB:6262 \ DB \ DBB.ADD(端口:62​​62)

測試訪問表:WEBORDERLN(ADT型)

PK:PK(CHAR(36))


我下載Advantage.Data.Provider V11和Advantage.Data.E ntity v11。 並添加引用。

的Web.config

<connectionStrings> 
    <add name="Ads_Context" connectionString="Data Source=\\ADS_DB:6262\DB\DBB.ADD;User ID=xxx;Password=xxx;ServerType=REMOTE;" providerName="Advantage.Data.Provider" /> 
</connectionStrings> 

控制器,

public class Ads_Context : DbContext 
{ 
    public Ads_Context(): base("name=Ads_Context") 
{ 
} 
public DbSet<WebOrderLN> webOrderLns { get; set; } 
} 

public class HomeController : Controller 
{ 
    // 
    // GET: /Home/ 

    public string Index() 
    { 
     var context = new Ads_Context().webOrderLns.ToList(); // Source error point to here 

     return "A"; 
    } 

} 
[Table("WEBORDERLN")] 
public class WebOrderLN 
{ 
    [Key] 
    public string PK {get; set;} 
    public string FK { get; set; } 
    public string pickno { get; set; } 
} 

當我上面的代碼運行,我得到一個錯誤信息,

Server Error in '/' Application. 
Error 7200: AQE Error: State = HY000; NativeError = 5174; [iAnywhere Solutions][Advantage SQL][ASA] Error 5174: Advantage failed to open the specified link. dbo: Error 7041: File not found. Verify the specified path and file name is correct. Table name: WEBORDERLN AdsCommand query execution failed. 

任何人都知道,我在做什麼錯?

回答

相關問題