index | search | no replies | posting guidelines | help login | register
Index » Products » ASP Report Wizard v2
search this forum:
:: Code examples in c# :: (2)Post a New Message | Post a Reply
Feb 17 2004, 9:33 PM
 Code examples in c#Post a Reply
 Polarwarp

View this author's profile Send this author a private message

from: Mel, Australia

Hi,

I was wondering if it was possible to provide an example for using this object with c#.  I was playing around with some code for a code-behind page and it works ok in vb.net but we really only use c# for our projects and I'd like to be able to do that with this object.    I had a go at trying to convert it myself but get a com exception.

My code looks like this:
AspWebSolution.DataGridClass objGrid =  new AspWebSolution.DataGridClass();
            //object objGrid = Server.CreateObject("AspWebSolution.DataGrid");
            object o = "SELECT * FROM Orders, Schedule where orders.orderID = schedule.orderID";
            objGrid.set_Command(ref o);
            objGrid.CreateConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=C:\\JobEntry\\OrderEntry.mdb;");
            objGrid.Display();
        
            objGrid = null;

Any ideas or c# code would be greatly appreciated so that I can have a play with this component.

Feb 19 2004, 4:22 PM
 Re: Code examples in c#Post a Reply
 whichman

View this author's profile Send this author a private message Visit author's homepage

from: Laurel, MD

There seems to be a problem running the ASP Report Wizard from an ASP.NET environment. This could possible be due to the ObjectContext.
I am still looking into the problem.

However, the graph works pretty fine. You can test it by trying the code below:

private  void btnGraph_Click(Object sender,  System.EventArgs e)
{
      try
     {                     
          AspWebSolution.SimpleGraph objGraph =  new AspWebSolution.SimpleGraph();
      
          objGraph.AddRow "10, 15, 20, 17, 5"();
          objGraph.AddRow "12, 10, 17, 15, 10"();
          objGraph.AddRow "5, 15, 10, 12, 7"();
                     
          objGraph.Legend = "Apples, Oranges, Lemons";
          objGraph.Title = "Fruit Sales";
          objGraph.yLabel = "Sales";
          objGraph.xLabel = "Stores";
          objGraph.XScaleValues = "NE, NW, SE, SW, CE";
          objGraph.xALign = "center";
                     
          lblGraph.Text = objGraph.GetGraph();    
          objGraph = null;
     }
      catch(Exception ex)
     {
          OutputBox.Text = Ex.Message;
     }
}


Try this one to test the Grid

private  void testGrid()
{
      try
     {                     
          AspWebSolution.DataGrid objGrid =  new AspWebSolution.DataGrid();    
          objGrid.Command = "SELECT * FROM Products";
          objGrid.CreateConnection("nwind");
          objGrid.Display();                     
          objGrid = null;                     
     }
      catch(Exception ex)
     {
          OutputBox.Text = Ex.Source  + "<br>"+  ex.Message;
     }
}


Remember to add a reference to the AspWebSolution DLL (AWSReportWizard2.dll) in your .NET project



-------------------------
Master of the Game
Pages: (1)   [1]

search this forum: