Question

I am having problem with ADS11 connection string for code first,

I've tried many way but I couldn't make it.

Anybody know, please advice me.

Here is my working environment.


Server : Advantage Database Server 11

Path : \ADS_DB:6262\DB\DBB.ADD (Port : 6262)

Test Access Table : WEBORDERLN (ADT Type)

PK : PK (Char (36))


I downloaded Advantage.Data.Provider v11 and Advantage.Data.Entity v11. And add to reference.

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>

Controller,

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; }
}

When I run above code, I got an error message,

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. 

Anybody know, what I am doing wrong?

Was it helpful?

Solution

Try adding the schema name of ::this to your tables in code.

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

See this Knowledge Base Item http://devzone.advantagedatabase.com/dz/content.aspx?Key=17&RefNo=120423-2510

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top