Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Dropdownlist

Dropdownlist

Scheduled Pinned Locked Moved ASP.NET
databasewpfwcfquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mahichandu
    wrote on last edited by
    #1

    Hi.. I have stored procedure to display listofdays by using year and month.My Storedprocedure filter all the Listofdays by leapyear and by month it will display listofdays. In my stored procedure i used two parameters month & Year.I want to bind lisofdays spro in code behind with two parameters and how i call this listofdays method to my dropdownlist?? I am using below methods for binding the data into datatable. Getdatatable Method

    sqlconn = GetConnection();
    cmd.Connection = sqlconn;
    da = new SqlDataAdapter(cmd);
    dt = new DataTable();
    da.Fill(dt);

               return (dt);
    

    Calling My Spro

    cmd = new SqlCommand("ndi_sp_GetDaysOfMonth", sqlconn);
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.Parameters.Add(new SqlParameter("@Month",DbType.Int16));
    cmd.Parameters.Add(new SqlParameter("@Year", DbType.Int16));

                    return GetDataTable(cmd);
    

    The method is correct.??If so when i put breakpiont and checking its not filling the data in datatable.:confused: Hope someone reply to my message..Thanks in advance

    N 1 Reply Last reply
    0
    • M mahichandu

      Hi.. I have stored procedure to display listofdays by using year and month.My Storedprocedure filter all the Listofdays by leapyear and by month it will display listofdays. In my stored procedure i used two parameters month & Year.I want to bind lisofdays spro in code behind with two parameters and how i call this listofdays method to my dropdownlist?? I am using below methods for binding the data into datatable. Getdatatable Method

      sqlconn = GetConnection();
      cmd.Connection = sqlconn;
      da = new SqlDataAdapter(cmd);
      dt = new DataTable();
      da.Fill(dt);

                 return (dt);
      

      Calling My Spro

      cmd = new SqlCommand("ndi_sp_GetDaysOfMonth", sqlconn);
      cmd.CommandType = CommandType.StoredProcedure;
      cmd.Parameters.Add(new SqlParameter("@Month",DbType.Int16));
      cmd.Parameters.Add(new SqlParameter("@Year", DbType.Int16));

                      return GetDataTable(cmd);
      

      The method is correct.??If so when i put breakpiont and checking its not filling the data in datatable.:confused: Hope someone reply to my message..Thanks in advance

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      The obvious question is, is your stored proc correct? Is the SqlCommand being executed properly but no data is being returned? Seems critical thinking and debugging skills are a lost art.


      only two letters away from being an asset

      M 1 Reply Last reply
      0
      • N Not Active

        The obvious question is, is your stored proc correct? Is the SqlCommand being executed properly but no data is being returned? Seems critical thinking and debugging skills are a lost art.


        only two letters away from being an asset

        M Offline
        M Offline
        mahichandu
        wrote on last edited by
        #3

        Yes..I Tested and executed my spro.Its working.When i am adding parameter values year and month..its displaying listofdays according to month and year.

        N 1 Reply Last reply
        0
        • M mahichandu

          Yes..I Tested and executed my spro.Its working.When i am adding parameter values year and month..its displaying listofdays according to month and year.

          N Offline
          N Offline
          Not Active
          wrote on last edited by
          #4

          Ok, so what else could you test? Apply some thought processes. It will develop your skills and may lead to an answer without having to ask people to solve it for you.


          only two letters away from being an asset

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups