locked
How to refer to a database fields from C# which is defined in a Crystal report RRS feed

  • Pergunta

  • Hi,

    I have defined a crystal report where I have added a database connection using xmlschema[xml]. I have few buttons added which i would like to activate/de-activate depends on certain field value of selected database  How do i control this through c# coding from main form. Can you help?

    Regards 
    sábado, 14 de fevereiro de 2009 05:14

Todas as Respostas

  •  Hi,

    I got the answer which is as follows:
      
       I wrote a function wherein  I  opened a  new dataset. I have a pre-defined xml file with cmhdr and othdet tables. Following code will give the value of fields to a variable:   

                DataSet ds = new DataSet();
                string xmlfile = @"xxxx.xml";
                ds.ReadXml(xmlfile);           
                try
                {
                   DataRow drI = ds.Tables["cmphdr"].Rows[0];
                   string mExpInvNo = drI["expinvno"].ToString();
                                  
                   DataRow dr = ds.Tables["OthDet"].Rows[0];
                   string mIsHzrds = dr["ishzrds"].ToString();                                      
                }
                catch (Exception er)
                {
                    MessageBox.Show(er.Message, "Error");
                } 

    Regards


    Mathew Antony Valliara
    terça-feira, 10 de março de 2009 11:46