Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8708155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:03:32+00:00 2026-06-13T04:03:32+00:00

I have an sql select script that will execute and shows that there is

  • 0

I have an sql select script that will execute and shows that there is data being selected when it is run. The problem I am having is trying to get that data to show in my calendar control. I wanted to change the calender by what department the user was from that logged in. Right now there is nothing showing and it will not show any data unless I hard code a department in it.

I am working with c# asp.net.

here is what I am doing to try and get the data

        private DataSet GetData()
    {
        var CurrUser = "a73      ";
        var UsrDepartment = "60      ";

        Account.Login uusr = new Account.Login();
        CurrUser = uusr.User.Identity.Name.ToString().ToUpper();

        ConnectionStringSettingsCollection cssc = ConfigurationManager.ConnectionStrings;

        var sql = "select (substring(status, 1,1)) AS stat1, lastname, firstname, ldate, edate,depdivid, requestid from TIME.employee E inner join TIME.request T on E.EMPID = T.empid where E.depdivid =  @UsrDepartment ";

        using (iDB2Connection conn = new iDB2Connection(GetConnectionString()))
        {
            conn.Open();

            using (iDB2Command cmd = new iDB2Command(sql, conn))
            {
                cmd.DeriveParameters();

                using (iDB2DataAdapter da = new iDB2DataAdapter(cmd))
                {
                    DataSet ds = new DataSet();
                    da.Fill(ds);

                    return ds;
                }
            }
        }
    }

I fill the calendar with this :

DataSet ds = GetData();    
foreach (DataRow row in ds.Tables[0].Rows)
                {
                    //need to fill from first to last date
                    string scheduledDate = Convert.ToDateTime(row["ldate"]).ToShortDateString();
                    string endDate = Convert.ToDateTime(row["edate"]).ToShortDateString();

                    e.Cell.Width = 120;
                    e.Cell.Height = 100;

                    Int32 start = 0;
                    Int32 end = 0;

                    start = string.CompareOrdinal(scheduledDate, s);
                    end = string.CompareOrdinal(endDate, s);

                    if ((start <= 0) & (end >= 0) & (!e.Day.IsWeekend))
                    {
                        HyperLink lb = new HyperLink();
                        lb.Text = link + (Int64)row["requestid"] + "' >" + row["lastname"] + "</a>" as String + "(" + row["stat1"] + ")" as String + "<br />";

                        //code to change color of button
                        if (scheduledDate == endDate)
                        {
                            lb.CssClass = "changecolor";
                        }
                        e.Cell.Controls.Add(lb);
                    }
                }

This way will show no links in my calendar, but if I make the department have a value(which is not what I wanted) it will show the links.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T04:03:33+00:00Added an answer on June 13, 2026 at 4:03 am

    I think you need a line like this

    cmd.Parameters["@UsrDepartment"].Value = myDept
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a few SQL (Select/Update/Insert) syntax that I will run inside PL/SQL one
The problem is that: In SQL Server,I have a SELECT statement that might take
Hi all I have the following SQL Server 2008 script that will check if
I am having some problems with linq-to-sql lately. The problem is that it thinks
I have a script that processes queued records in a SQL table in SQL
I am currently trying to script a job on SQL Server 2005 that will
I know there is a class system.data.sqlclient.sqlcommand that can execute a batch at a
I like to create a generic perl script that will input sql query from
I trying to make a sql script that will randomize the city, state, and
I have this SQL change script that runs as part of my nant orchestrated

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.