none
Reload the Ms access Database in c# RRS feed

  • Question

  • Hello to everyone :)

    i'm developing winform application in c#3.5. i hav doubt in ms access database.

    its my coding

    private void button2_Click(object sender, EventArgs e)
            {
               OleDbCommand cmdDel = new OleDbCommand("delete from TempForPurchaseDetails", con);
                        cmdDel.ExecuteNonQuery();

                        OleDbCommand cmdTest = new OleDbCommand("INSERT INTO TempForPurchaseDetails(PurID,PDate,TotalAmount,TotalRoundAmount,TotalDiscountAmount,PFrom,PQty) select P.PurID,P.PurDate,P.TotalNetAmount,P.TotalRoundedAmount,P.TotalDiscountAmt,P.PurFrom,SUM(P1.PQty) from PurchaseDetails AS P INNER JOIN PurchaseProductDetails AS P1 ON P.PurID = P1.PurID GROUP BY P.PurID,P.PurDate,P.TotalNetAmount,P.TotalRoundedAmount,P.TotalDiscountAmt,P.PurFrom", con);
                        cmdTest.ExecuteNonQuery();


                        DataSet dd = clsconn.getdatasetfromquery("select * from TempForPurchaseDetails");
                        if (dd == null || dd.Tables.Count == 0 || dd.Tables[0].Rows.Count == 0)
                        {
                            MessageBox.Show("Information Noggt Found!", "Ërror", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        else
                        {
                            Report_PurchaseAll report1 = new Report_PurchaseAll();
                            report1.SetDataSource(dd.Tables[0]);
                            crystalReportViewer1.ReportSource = report1;
                        }

    }

    in this table have some datas but it not display.becoz i did insert and selecting in one block(button1_click).so its didnt executed.

    can u anyone tell me how can i insert and selecting within block..this s very urgent :(

    help me situation !


    Thanks & Regards,

    Friday, September 7, 2012 5:36 AM

Answers

  • Hi Brinda,

    It seems that you used a crystal report control to display the data.

    Did you check the dd.Tables[0]? Does the code get the data correctly?

    I think the reason why the control doesn't display data correctly is that we need to refresh the crystal report control, you may try call 

    report1.Refresh after SetDataSource methodcrystalReportViewer1.Refresh and crystalReportViewer1.Show method after you set crystalReportViewer1.ReportSource property.

    Beside, for crystal report issue, you can get better help in SAP crystal report forum.

    Best Regards,


    Bob Wu [MSFT]
    MSDN Community Support | Feedback to us

    Monday, September 10, 2012 7:49 AM
    Moderator

All replies

  • Hi Brinda,

    It seems that you used a crystal report control to display the data.

    Did you check the dd.Tables[0]? Does the code get the data correctly?

    I think the reason why the control doesn't display data correctly is that we need to refresh the crystal report control, you may try call 

    report1.Refresh after SetDataSource methodcrystalReportViewer1.Refresh and crystalReportViewer1.Show method after you set crystalReportViewer1.ReportSource property.

    Beside, for crystal report issue, you can get better help in SAP crystal report forum.

    Best Regards,


    Bob Wu [MSFT]
    MSDN Community Support | Feedback to us

    Monday, September 10, 2012 7:49 AM
    Moderator
  • thanks for reply :)

    but error occur

    DataSet dd = clsconn.getdatasetfromquery("select * from TempForPurchaseDetails");

    Not data found


    Thanks & Regards,

    Thursday, December 27, 2012 6:58 AM