2 DataSources mess

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for SQLite
Post Reply
eugenem
Posts: 8
Joined: Fri 04 Feb 2011 20:48

2 DataSources mess

Post by eugenem » Fri 04 Feb 2011 20:57

I've attached 2 datasources to the same dataset.datatable. One datasource has filter, another one hasn't. One that has filter overloads one without filter and I see only filtered rows through both sources. This is so annoying :evil:

The system was working flawlessly without dotConnect (in-memory DataSet).

3.10.96 version + VS 2010 / .NET 4 + WinXP

Please help!

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Tue 08 Feb 2011 14:50

As I understood, you have one datasource (DataSet.DataTable) and two BindingSources which use the same view. Please split the view explicitly when working with our SQLiteDataTable as it is described for OracleDataTable in this thread: http://www.devart.com/forums/viewtopic.php?t=15600. If this doesn't help, send us a small test project with the corresponding DDL/DML script to reproduce the issue in our environment.

eugenem
Posts: 8
Joined: Fri 04 Feb 2011 20:48

Post by eugenem » Fri 11 Feb 2011 00:18

thanks for the idea, it seems to work partially

what happens now is that i cannot attach combobox to such source, i'm just getting empty recordset:

cbGroupVar.DataSource = new Devart.Common.DbDataTableView(ds2.Fields);
cbGroupVar.DisplayMember = "Title";
cbGroupVar.ValueMember = "Title";

when I assign such dataview to grid it does work

what am I missing?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Mon 14 Feb 2011 17:30

I have checked the 3.10.96 version of dotConnect for SQLite. It works correctly with the code you have mentioned. The most probable reason is that the cbGroupVar.DataSource = new Devart.Common.DbDataTableView(ds2.Fields); line was removed from *.Designer.cs by Form Designer. For example, you set the cbGroupVar.DataSource property manually in the *.Designer.cs, saved it, but then opened cbGroupVar's designer on Form Designer, edited it and saved - all its properties were re-initialized, and your own code was removed by designer.

Notify us about the results.

eugenem
Posts: 8
Joined: Fri 04 Feb 2011 20:48

Post by eugenem » Mon 14 Feb 2011 20:51

this code isn't in the designer.cs

public Form1()
{
InitializeComponent();

cbGroupVar.DataSource = new Devart.Common.DbDataTableView(ds2.Fields);//, "Direction = 'Group'", "Title", DataViewRowState.CurrentRows);
cbGroupVar.DisplayMember = "Title";
cbGroupVar.ValueMember = "Title";

ugFields.DataSource = new Devart.Common.DbDataTableView(ds2.Fields);
}

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Tue 15 Feb 2011 11:08

Please try this code (ds.Table.Active = true):

Code: Select all

public Form1()
{
InitializeComponent();

ds2.Fields.Active = true;
cbGroupVar.DataSource = new Devart.Common.DbDataTableView(ds2.Fields);
cbGroupVar.DisplayMember = "Title";
cbGroupVar.ValueMember = "Title";

}

eugenem
Posts: 8
Joined: Fri 04 Feb 2011 20:48

Post by eugenem » Wed 16 Feb 2011 22:31

doesn't help

ok, i'll make sample project and will send you...

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Thu 17 Feb 2011 09:32

You can send us your test project via our contact form. Also please attach your test database.

eugenem
Posts: 8
Joined: Fri 04 Feb 2011 20:48

Post by eugenem » Thu 17 Feb 2011 11:39

Ok, I've figured the problem. I had to apply this workaround after loading new db.

BTW, ds2.Fields.Active = true crashes when doing it after db was loaded, but filters work without making table active anyway.

Thanks for help!

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Thu 17 Feb 2011 12:46

eugenem wrote:BTW, ds2.Fields.Active = true crashes when doing it after db was loaded
Please specify the error message and your call stack. If possible, send us a small test project with your database.

eugenem
Posts: 8
Joined: Fri 04 Feb 2011 20:48

Post by eugenem » Fri 18 Feb 2011 11:32

System.InvalidOperationException was unhandled
Message=No data exists for the row/column.
Source=Devart.Data.SQLite
StackTrace:
at Devart.Data.SQLite.SQLiteDataReader.a(Int32 A_0, String A_1)
at Devart.Data.SQLite.SQLiteDataReader.GetValue(Int32 i)
at Devart.Data.SQLite.SQLiteDataTable.GetField(DataRow row, Int32 rowInd, IDataReader reader, Int32 readerInd)
at Devart.Data.SQLite.SQLiteDataTable.GetDataRow(DataRow row)
at Devart.Common.DbDataTable.a(Int32 A_0, Boolean A_1, Boolean A_2)
at Devart.Common.DbDataTable.c(Boolean A_0)
at Devart.Common.DbDataTable.c()
at Devart.Common.DbDataTable.Open()
at Devart.Common.DbDataTable.set_Active(Boolean value)
at ExperiMind.Form1.attachGrids() in C:\Documents and Settings\Administrator\My Documents\...\Form1.cs:line 468
at ExperiMind.Form1.openToolStripMenuItem_Click(Object sender, EventArgs e) in C:\Documents and Settings\Administrator\My Documents\...\Form1.cs:line 3595
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.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 ExperiMind.Program.Main() in C:\Documents and Settings\Administrator\My Documents\...\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Mon 21 Feb 2011 17:21

I cannot reproduce the problem with the 3.10.96 version of dotConnect for SQLite at the moment: generated the typed SQLiteDataSet via the Tools > SQLite > DataSet Wizard menu of Visual Studio, created instance of this DataSet in my code, and set dataSet.DataTable.Active=true. It works.

Please send us a small test project with your test SQLite database to reproduce the problem in our environment. Also specify your current version (x.xx.xxx) of dotConnect for SQLite: the Tools > SQLite > About menu of Visual Studio.

Post Reply