MS Access error when .ToList() is called
See original GitHub issueI try with access database. It generates error.
Exception message: System.Data.OleDb.OleDbException: 'No value given for one or more required parameters.'
Stack trace:
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr)
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.OleDb.OleDbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
at LinqToDB.Data.DataConnection.ExecuteReader(CommandBehavior commandBehavior) in C:\projects\linq2db\Source\LinqToDB\Data\DataConnection.cs:line 1227
at LinqToDB.Data.DataConnection.QueryRunner.ExecuteReader() in C:\projects\linq2db\Source\LinqToDB\Data\DataConnection.QueryRunner.cs:line 445
at LinqToDB.Linq.QueryRunner.<ExecuteQuery>d__9`1.MoveNext() in C:\projects\linq2db\Source\LinqToDB\Linq\QueryRunner.cs:line 320
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Hotel.MainUi.btnUpload_Click(Object sender, EventArgs e) in D:\Projects\NET\Armadillo\Hotel\MainUi.cs:line 45
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Hotel.Program.Main() in D:\Projects\NET\Armadillo\Hotel\Program.cs:line 19
public class Member
{
[PrimaryKey, Identity]
public long ID { get; set; }
public string Number { get; set; }
public string Name { get; set; }
public string Address { get; set; }
public DateTime Birthdate { get; set; }
public bool Married { get; set; }
}
public class DataContext : LinqToDB.Data.DataConnection
{
public DataContext()
: base("Access", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\\sugar.mdb;Locale Identifier=1033;Jet OLEDB:Engine Type=5;Persist Security Info=True;Jet OLEDB:Database Password=sugar1109", LinqToDB.Mapping.MappingSchema.Default)
{ }
public ITable<Member> Members => GetTable<Member>();
}
private void btnUpload_Click(object sender, EventArgs e)
{
var context = new DataContext();
var models = context.Members.ToList();
}
Environment details
linq2db version: 2.6.2 Database Server: Microsoft Access Database Provider: Access Operating system: Windows 10 Framework version: .NET Framework 4.6.2
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
"The expression you entered has a function name that ...
I have a Access 2007 macro that throws a strange (to me) error message when it runs: "The expression you entered has a...
Read more >I get a message about data type mismatch
This error indicates that Access cannot match an input value to the data type it expects for the value. For example, if you...
Read more >No Errors but No Results from ToList()
I figured it out. I was using the wrong table name to start with, but then I also needed to add Database.SetInitializer<Models.MyDbContext>(null); ...
Read more >How to Handle Data Type Mismatch Errors in Microsoft Access
In this Microsoft Access tutorial, I'm going to teach you how to deal with data type mismatch errors in your database. We'll look...
Read more >Bad DLL Calling Convention Error in Microsoft Access ...
From the VBA IDE, go under Tools, References to see the list of referenced libraries and make sure none of the checked items...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Did some research - actually access provider generates such error when you query unknown object. E.g. you have typo in column name. So I would recommend to check that your table definition match your mappings
Long (int64) type is not supported by access. Access LONG type is int32 actually