Length record in Access

Sep 11, 2009 at 3:21 PM

Hi. What is change limit with length record in Access?

String = 2000 byte.

What is unlimited?

Coordinator
Sep 12, 2009 at 4:58 PM

There is no unlimited text size in Access.  You need to use a memo field to store large strings.

Coordinator
Sep 12, 2009 at 5:05 PM

The size of 2000 came from the original default size that all the providers were originally using.  In the last update, I changed the sql server provider to consider unsized strings to be max-integer size and added an overridable property that all providers could declare their appropriate default size.  They all got seeded with the number that was previously being used. This size is really only used for parameter size.  I don't have any specific reason to believe the original value of 2000 is correct for Access, just that it was working okay so far. A quick search on the internet (bing) tells me that the maximum may be actually 255 characters.  I'll have to dig deeper to see if that is true. 

Sep 13, 2009 at 8:52 AM

Thank you as explanation, but where error?
-------------
Access table:
id [counter]
title [string]
html [memo]
-------------
Class:
/////////////
public class HtmlText
{
     public int Id {get;set;}
     public string Title {get;set;}
     public string Html {get;set;}
}
/*Attributes*/
[Table]
[Column(Member="id", IsPrimaryKey=true, IsGenerated=true)]
[Column(Member="title")]
[Column(Member="html")]
public override IEntityTable<HtmlText> HtmlTexts
{
     get { return base.HtmlTexts; }
}
--------------
Data:

public HtmlText Insert(HtmlText htmlText)
{
         try
        {
                _session.HtmlTexts.InsertOnSubmit(htmlText);
                _session.SubmitChanges();
                return htmlText;
         }
         catch
         {
                return null;
         }
}

Coordinator
Sep 14, 2009 at 7:06 PM

You can give more precise information in the mapping attributes. 

[Column(Member="title", DbType="varchar(50)"]

The insert command will use the mapping information over the default size.

Coordinator
Sep 14, 2009 at 7:17 PM

I've tried your example and see no exception.  Are you using a .mdb file or Access 2007 .accdb file?

Sep 16, 2009 at 12:38 PM
mattwar wrote:

I've tried your example and see no exception.  Are you using a .mdb file or Access 2007 .accdb file?

 Yes. Access 2003 database file (*.mdb)

[Table]
[Column(Member="id", IsPrimaryKey=true, IsGenerated=true)]
[Column(Member="title")]
[Column(Member="html", DbType="varchar(5000)")]
public override IEntityTable<HtmlText> HtmlTexts
{
     get { return base.HtmlTexts; }
}

Insert Method see exception: Too few parameters. Expected 3.
Coordinator
Sep 16, 2009 at 3:57 PM

Can you paste in the stack trace of the exception?