Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2008
    Posts
    6

    Unanswered: Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX

    Hi to all,

    I want to workout dynamic crystal report binding(no need to design the column at design time and runtime programaticaly we can design it) using Crystal Reports ActiveX Designer Design and Runtime Library 11.0. My code is

    private void Method4()

    {


    string gs_connectionstr, sSQL, AppPath, fs_Report; int counter;

    try

    {

    AppPath = Server.MapPath(".");

    gs_connectionstr = "Provider =Microsoft.Jet.OleDB.4.0; Data Source = " + AppPath + "\\db1.mdb";

    g_Connection.ConnectionString = gs_connectionstr;

    g_Connection.Open();

    sSQL = "Select * From Table1";

    //counter += 1;

    EmpDataADapter.SelectCommand = new OleDbCommand(sSQL,g_Connection);

    if (EmpDataset.Tables["Employee"] != null )

    EmpDataset.Tables["Employee"].Clear();

    EmpDataADapter.Fill(EmpDataset, "Employee");



    fs_Report = Server.MapPath( ".");

    Report = Crystal.OpenReport(fs_Report + "\\CrystalReport1.rpt",OpenReportMethod.OpenReport ByDefault);

    Report.DiscardSavedData();

    Report.Database.SetDataSource(EmpDataset.Tables[0],null,null);

    CrystalReportViewer1.ReportSource = Report;

    CrystalReportViewer1.RefreshReport();


    }

    catch (Exception ex)

    {

    throw ex;

    }

    }

    Whenever the control meet this line

    Report.Database.SetDataSource(EmpDataset.Tables[0],null,null);

    then it return the error as follows

    Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))

    May i know why this error is occur and how to solve this, Experts please help me.

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Any reason why you're using the index as opposed to a named index as you've done further up your code?
    e.g.
    Code:
    EmpDataset.Tables["Employee"].Clear();
    George
    Home | Blog

  3. #3
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Oh, and perhaps your use of Clear() is what is causing the invalid index exception?
    George
    Home | Blog

  4. #4
    Join Date
    Aug 2008
    Posts
    6
    George

    Thanks for your response. Actualy first i was checked it with EmpDataset.Tables["Employee"] then also it's not working. Could you please tell me what is the problem?

  5. #5
    Join Date
    Aug 2008
    Posts
    6
    George,
    Thanks for your response, if i change the code like this Report.Database.SetDataSource(EmpDataset.Tables["Employee"].Clear(), 3, 1);
    then build error is occur as :
    Error 1 The best overloaded method match for 'CRAXDDRT.IDatabase.SetDataSource(object, object, object)' has some invalid arguments.

    Could you please tell me, why this happened? and how to solve this issue?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •