Click here to Skip to main content
15,902,114 members

Comments by preetpal kapoor (Top 16 by date)

preetpal kapoor 18-Sep-14 8:35am View    
As far as I know the global.asax file is created for each project but I need to implements a single solution for all the applications. In case of global.asax file I have to create this file in each applications and then I have to re-deploy applications on all the environements.
preetpal kapoor 17-Apr-14 10:17am View    
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
preetpal kapoor 14-Oct-13 2:38am View    
ISNULL is required to track if there is any NULL values and I have converted all the NULL values to 'NULL' (i.e. a string value).. It was the requirement :)
preetpal kapoor 11-Oct-13 10:31am View    
I used coalesce , but the query was giving some error when I ran it in the SSRS report. And I cnt remove IN becz the variables are having list of data into it.
preetpal kapoor 11-Oct-13 10:11am View    
ISNULL function is used on left side in the query ... u mean that I should use it on right side???..

Also I cnt use '=' as there are list of values in variables.