views:

27

answers:

1

public void crys() {

    con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:/Documents and Settings/techsoft/My Documents/Database.accdb;Persist Security Info=False");
    con.Open();
    OleDbCommand cmm=new OleDbCommand ("select * from Table3",con);
    DataSet ds=new DataSet ();
    OleDbDataAdapter db=new OleDbDataAdapter ();
    db.SelectCommand =cmm ;
    db.Fill (ds);
    comboBox1 .DataSource =ds.Tables [0];
    comboBox1 .DisplayMember ="logindate";
    comboBox1 .ValueMember ="login";
    comboBox1.SelectedIndex = 0;


    }

    private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
    {


        CrystalReport1 cry = new CrystalReport1();
        //cry.SetDatabaseLogon("techsoft", "softTECH123", @"Microsoft Office Access 2007", "Database");
        crystalReportViewer1.SelectionFormula ="{Table3.login}="  +comboBox1.SelectedIndex;
        crystalReportViewer1.ReportSource = cry;

    }


this is my code .my error is in selection formula it throws exception like "string is required here" plz suggest some solution

A: 

Try this

crystalReportViewer1.SelectionFormula ="{Table3.login}='" +comboBox1.SelectedIndex + "'";
Anuraj
Thank You so much its working fine
ush
Welcome Ush. Mark it as answer, if it is working fine :)
Anuraj