Hi, I have a windows form app which binds data to a gridview. I just want to display data not editing. I have 32 columns in each row. When I have 40k rows to display gridview shows only around 25k rows,rest of the rows are not displayed and not even in excel when i exported. I came to know that WPF is better option but i have already finished my work,no time to recreate entire app in WPF. Heard that virtual mode makes it work but i dono how to implement it in my win form.. Below is my display form code.. Pls help me with the code changes to display 40k rows..tomorrow is my deadline..thanks in advance..
namespace HSR_GvHo_Report
{
public partial class DataDisplay : Form
{
public static string _TableNm,_TableNm3, _FromDate, _TillDate,_frmdate,_todate, connstrr;
MenuParams mparams = new MenuParams();
string path;
DataTable dt;
public DataDisplay(string _TableName, string _TableName3,string _FDate, string _TDate, string _FrDate, string _ToDate, string constr)
{
InitializeComponent();
_TableNm = _TableName;
_TableNm3 = _TableName3;
_FromDate = _FDate;
_TillDate = _TDate;
_frmdate=_FrDate;
_todate=_ToDate;
connstrr = constr;
}private void DataDisplay_Load(object sender, System.EventArgs e)
{
lblFrom.Text = _FromDate;
lblTill.Text = _TillDate;
dt = CreateDataTable(_TableNm);
dgLoadData.DataSource = dt;
private DataTable CreateDataTable(string _TableNm)
{
string Qry = null;
dt = new DataTable();
using (SqlConnection conn = new SqlConnection(connstrr))
{
try
{
if (conn.State == ConnectionState.Closed || conn.State == ConnectionState.Broken)
{
conn.Open();
}
string b = _FromDate;
string b1 = _TillDate;
Qry = "select GLZone,GLState,GLCity,a.Showroomname,a.Stockno,b.Field1,Class1Cd,Class2Cd,SubClass1Cd,SubClass2Cd,Sizecd,ItemDesc,"+
" a.MonthOpDate,a.OpeningQty,PurchaseQty,SReturnQty,a.ReceiptDate,PurRetQty,SalesQty,a.ClosingQty,DaysOld,Retail_Price,"+
" Cost_Price,CashSaleVal,CashRetVal,AnalCode1,AnalCode2,AnalCode3,AnalCode4,AnalCode5,userid"+
"From TEMPSTOCKMOVEMENTsuper as a left join TEMPConIMEIsuper as b "+
"on a.Showroomname=b.Showroomcode and a.Stockno=b.Stockno and a.MonthOpDate=b.MonthOpDate"+
" ORDER BY GLZone,GLState,GLCity,Showroomname,Stockno,Class1Cd,Class2Cd,SubClass1Cd,SubClass2Cd,Sizecd,ItemDesc ";
SqlDataAdapter da = new SqlDataAdapter(Qry, conn);
da.Fill(dt);
}
catch (Exception ex)
{
LogWriter.WriteLine(ex.Message);
LogWriter.WriteLine(ex.StackTrace);
}
finally
{
if (conn.State == ConnectionState.Open || conn.State == ConnectionState.Connecting)
{
conn.Close();
}
}
}
return dt;
}
}