Link to home
Start Free TrialLog in
Avatar of shpresa
shpresaFlag for United States of America

asked on

charts in visual basic

I am trying to build some charts using Visual studios2010, and they work when i use a sql connection,  with a store procedure with no paramenters, but they don't when i use a store procedure that requires 3 parameters, i test the store procedure and it works fine..

am i missing anything.?

anything i should consider?
Avatar of Miguel Oz
Miguel Oz
Flag of Australia image

Can you post the code you are using to call the store proc and chart?
I will check first whether your C# code that run the store proc is defining the sql parameters properly and that the results are the same as per your SQL test for the same parameter values.
For more info check:
Avatar of shpresa


Its done thro the design view on visual studios...

This is what i have, the store procedure works fine.
<asp:Chart ID="Chart1" runat="server" DataSourceID="SqlDataSource1" >
                <asp:Series Name="Series1" XValueMember="Race_Ethnicity" YValueMembers="Number">
                <asp:ChartArea Name="ChartArea1">
        <asp:SqlDataSource ID="SqlDataSource1" runat="server"
            ConnectionString="<%$ ConnectionStrings:Website2ConnectionString %>"
            SelectCommand="sp_RACE_ETHNICITY_Eval1" SelectCommandType="StoredProcedure">
                <asp:SessionParameter DefaultValue="0" Name="OrgID" SessionField="OrgID"
                    Type="Int32" />
                <asp:Parameter Name="date2" Type="DateTime" />
                <asp:Parameter Name="date1" Type="DateTime" />
Avatar of Miguel Oz
Miguel Oz
Flag of Australia image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of shpresa


--ALTER    procedure [dbo].[sp_RACE_ETHNICITY_Eval1] (@OrgID as int,@date2 as datetime,@date1 as datetime) AS

declare @OrgID as int
set @OrgID = 0
declare @date2 as smalldatetime
declare @date1 as smalldatetime
set @date1 = '1900-10-22'
set @date2 = '2012-10-22'
Set Nocount On
Avatar of shpresa


But in he same time,
I have a form in the website where i input the parameters..
date1 and date 2, and orgID is already in a session.
When i display the same store procedure in a gridview this is what i have.

 SqlCommand cmd3;
        cmd3 = new SqlCommand("sp_RACE_ETHNICITY_Eval1", myConnection);
        cmd3.CommandType = CommandType.StoredProcedure;
        cmd3.Parameters.Add(new SqlParameter("@date1", strdate1.Text.Trim()));
        cmd3.Parameters.Add(new SqlParameter("@date2", strdate2.Text.Trim()));
        cmd3.Parameters.Add(new SqlParameter("@OrgID",  Session["OrgID"].ToString()));
Avatar of shpresa


i added the default values  and kind of gave a control ID.. it worked..thanks for the help