Click here to Skip to main content
15,881,380 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am trying to pass the values to the parameter of SP which is been called in my RDLC file .

When I am trying to run the SP on SSMS by passing mulitple values then the SP is running fine , but same if I try to do by running the application then the RDLC is showing only 1 record instead of more than one.

Could you please help me in this issue.

Thanks,
Posted
Comments
Richard C Bishop 14-Apr-14 11:26am    
Need to see the code.
Suk@nta 14-Apr-14 13:38pm    
please put your code here
preetpal kapoor 17-Apr-14 10:17am    
protected void btnOk_Click(object sender, EventArgs e)
{

string command = @"dbo.app_test";
GridView1.Visible = true;
SqlConnection con1 = connection_build();
SqlCommand cmd = new SqlCommand(command, con1);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@appname",SqlDbType.VarChar).Value=appname_values();
cmd.Parameters.Add("@UserID", SqlDbType.VarChar).Value = userid_values();

SqlDataAdapter da = new SqlDataAdapter(cmd);
con1.Close();
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
}

protected string userid_values()
{
string userid = "";
int cnt = ddluserid.GetSelectedIndices().Count();

for (int i = 1; i <= cnt; i++)
{
if (ddluserid.Items[i].Selected)
{

if (i == cnt)
{
userid += ddluserid.Items[i].Text ;
}
else
userid += ddluserid.Items[i].Text + ",";

//if (i == cnt)
//{
// userid += "'" + ddluserid.Items[i].Text + "'";
//}
//else
// userid += "'" + ddluserid.Items[i].Text + "',";
}
}


return userid;
}

protected string appname_values()
{
string appname="";
int cnt = ddlappname.GetSelectedIndices().Count();

for (int i = 1; i <= cnt;i++ )
{
if(ddlappname.Items[i].Selected)
{

if (i == cnt)
{
appname += ddlappname.Items[i].Text ;
}
else
appname += ddlappname.Items[i].Text + ",";


//appname += "'" + ddlappname.Items[i].Text + "'";
//if (i == cnt)
//{
// appname += "'" + ddlappname.Items[i].Text + "'";
//}
//else
// appname += "'" + ddlappname.Items[i].Text + "',";
}
}


return appname;
}

Above is the code given .. Please help me out with the problem

1 solution

maybe the there is a hard code value in SSMS
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900