2

I'm using the newly released Managed ODP.NET driver from Oracle to connect to my database (see here). Connection setup is fine. I now try to use a very simple LINQ to SQL example. The problem is that I get the an ArgumentOutOfRangeException. It appears on the foreach-Statement.

My very simple object:

[Table(Name = "my_mgr.ADDRESS")]
public class Address
{
    [Column(Name = "NAME")]
    public string Surname;

    [Column(Name = "VNAME")]
    public string Forename;

    [Column(Name = "ANZ")]
    public int Anz;
}

The part of testing the query:

DataContext db = new DataContext(inst.Connection);
Table<Address> addressTable = db.GetTable<Address>();

if (addressTable != null)
{
    //"SELECT * from my_mgr.ADDRESS WHERE anz > 0";
    var query = from p in addressTable where p.Anz > 0 select p;

    foreach (var p in query)
    {
        MessageBox.Show(
            "Forename: " + p.Forename + "\n" +
            "Surname: " + p.Surname
        );
    }
}

Whereas my original SQL query was (which is actually working):

SELECT * from my_mgr.ADDRESS WHERE anz > 0

I actually searched a lot for this but I cannot find valid results since the driver is very new and it seems nobody had the problem before. I am very sure that the driver supports LINQ to SQL, as stated on this website. Sadly I'm not able to use neither the Entity Framework nor auto-generation tools provided by Visual Studio.

1
  • 1
    used to be that linq to sql was for SQL Server (not Oracle, this would require Linq to Entity). So this has changed (honestly not sure for latest incarnation)? Commented Feb 26, 2013 at 15:03

1 Answer 1

1

Linq to SQL does not support Oracle. If you want to use ODP.NET and Linq just like linq to sql, I suggest you use ALinq. http://www.alinq.org

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.