I've just used a sample project ( Q181109 ) in your website to load a Grid Control with 200 Columns & more than 3.000.000 rows. It's out of memory when open the form ( can open with 400.000 rows but very slow performance, it takes 3 minutes ).
I'm testing with DX 2010.2.4 trial.
Can you show me the best solution ?
Thanks
Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Hi Vu,
I don't see where you used server mode in the sample project. Although, you don't provide a database, I can see the "table.Load(reader);" line of code. This code loads the entire table (200 Columns & more than 3.000.000 rows) to the local data table. This is the common WinForms DataSet approach, but not a server mode usage. Please refer to the Server Mode help topic to learn how to use server mode and XPO.
Thanks,
Ted
Hi Ted
Thanks for your reply.
I read the Server Mode document and build data source with XPO framework.
Because I always use Store and Query in project to load gird so I create a project like this blog http://community.devexpress.com/blogs/garyshort/archive/2010/09/22/xpo-stored-procedure-support-coming-in-v2010-vol-2.aspx#cooumments but It doesn't have a session property of XPDataView
Please help me fix that problem
Thank Ted.
Hi Vu,
Attached, is a sample project illustrating how to use a server mode. It uses the Northwind database (Products table) located on a local MSSQL Server and bound to the GridControl via theXPInstantFeedbackSource. To use this approach persistent objects should be created. Please refer to the Generating Persistent Objects for Existing Data Tables help topic, to learn how to create these objects from existing data tables. I hope this information will be helpful to you.
Thanks,
Ted
Hi Ted, about Generating Persistent Objects for Existing Data Tables
I can't generate some tables because These are disabled to select ( I think my table having more )
than 2 Primary keys )
Please give me a new instructions.
Thanks a lot.
Hi Vu,
Yes, tables with compound primary keys aren't supported by a wizard, but they are supported by XPO. This means that you can use these tables but you should create a persistent class manually. Please refer to the following KB article to learn more about how to use tables with compound primary keys: How to create a persistent object for a database table with a compound key.
Alternatively, you can use LINQ-to-SQL. XPO also supports LINQ-to-SQL classes, but only in read-only mode. Please refer to the LinqServerModeSource Class and LinqInstantFeedbackSource Class help topics, to learn more.
Thanks,
Ted
Hi Ted
When I exec a project like http://www.devexpress.com/Support/Center/p/A2615.aspx, it shows an error.
Please help me fix it.
Thanks a lot
Hi Vu,
I don't know what the error is in the project, so how can I help you solve it? Also, I cannot run the project, because I don't have the database you're using. So, please provide a bit more information if you need our assistance.
Thanks,
Ted
OK. I attach a new project to you with a SQL Script to create database.
When I try to Load_Form3, It shows : "Classes with struct members are not supported"
Thanks Ted
Hi Vu,
I've reviewed the project you sent. In it, XPDataView is used. This is not a server mode approach. XPDataView and other similar components are used to directly send queries to a database and return the result as XP objects. However, these components do not have any relation to server mode. And, yes, XPDataView doesn't support compound keys. Generally, the entire XPO doesn't support compound keys. The approach proposed in the mentioned KB article only provides backward compatibility when you already have a database and don't have any chance to change its structure. So, if you need to enable server mode, you should use the approach I showed you in the sample project attached to one of my previous messages. Only XPServerCollectionSource, XPInstandFeedbackSource, LinqServerModeSource and LinqInstandFeedbackSource can be used as a data source for GridControl to enable server mode. Other approaches will lead to the same result as if you are using a common DataSet - first, you execute a query, retrieve data, store it locally, and then show it in a data-aware control. Please review the documentation articles I gave you the links to and other documentation related to server mode.
Thanks,
Ted
I did project with server mode many time, but not ok for me. I search in
your website and make a project like http://www.devexpress.com/Support/Center/p/Q141364.aspx.
Here the code :
InitializeComponent();
SqlConnection conn = new SqlConnection("server=(local); Initial Catalog=Contoso_NAV_Staging_2; Integrated Security=SSPI");
conn.Open();
SqlCommand cmd = new SqlCommand("Select top 1 * from [dbo].[G_L Entry]", conn);
SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.KeyInfo);
DataTable table = new DataTable("myTable");
table.Load(reader);
conn.Close();
ReflectionDictionary dict = new ReflectionDictionary();
XPClassInfo classInfo = new XPDataObjectClassInfo(dict.GetClassInfo(typeof(LiteDataObject)), "dataset");
List<string> keyColumns = new List<string>();
foreach (DataColumn key in table.PrimaryKey)
{
keyColumns.Add(key.ColumnName);
}
foreach (DataColumn col in table.Columns)
{
if (keyColumns.Contains(col.ColumnName)) {
classInfo.CreateMember(col.ColumnName, col.DataType, new KeyAttribute());
}
else
{
classInfo.CreateMember(col.ColumnName, col.DataType);
}
}
xpServerCollectionSource1 = new XPServerCollectionSource(session1, classInfo);
XpoDefault.DataLayer = XpoDefault.GetDataLayer(DevExpress.Xpo.DB.MSSqlConnectionProvider.GetConnectionString(@"(local)", "Contoso_NAV_Staging_2"), dict, AutoCreateOption.None);
gridControl1.ServerMode = true;
gridControl1.DataSource = xpServerCollectionSource1;
But It cannot popup the form with 3.000.000 row. What happened ? Can you help me fixed the code above
Thanks for your support.
Hi Vu,
The approach from these articles is correct. In order to make this approach work, you should pass a correct table name in the XPDataObjectClassInfo constructor. Also, the best practice is to initialize DataLayer only once when the application starts. I've modified this code, taking all the explanations into account, and created a sample project. You will find it in the attachment. I hope it will be helpful to you.
Thanks,
Ted