Monday, 16 September 2013

get all procedures in SQL server

select * from sysobjects where type ='p' order by crdate desc

                  or

--->>Getting Specified procedure Details

SELECT name, create_date, modify_date
FROM sys.objects
WHERE type = 'P'
AND name = 'SP_NAME'

Wednesday, 10 July 2013

Getting page name from URL's

         string sourcePath = Request.RawUrl;/*this for mapped URL*/
            string destPath = Request.Url.AbsolutePath;/*this is for URL*/
            System.IO.FileInfo fInfo= new System.IO.FileInfo(sourcePath);
          string pagename=fInfo.Name.ToString();

Monday, 8 July 2013

getting Querystring value from MAPPED URL

-->> pass like{sample.aspx?id=1}    


 if (Request.RawUrl.LastIndexOf("id=") != -1)
            {
                int index = Request.RawUrl.LastIndexOf("id=");
               string  id = Request.RawUrl.Substring(index + 3);
            }

Monday, 24 June 2013

Working With Generics

working with generics

create a class-->>declare the properties/variable-->>with in the class create a Method with inherited one(here it will be inherited from the Interface{Class:Interface})


public class sample:ICreatable
{
  public string ramu {get;set;}

   public void Create(SqlDataReader Reader)
   {
    ramu=Convert.ToString(Reader["DBname"]);
   }
}

/*------this is the list-------*/

List<sample> sampledata = new List<sample>();


public class DAGetList
{
    public static List<T> GetListFromCommand<T>(SqlCommand sqlcmd)
    where T : ICreatable, new()
    {
        List<T> results = new List<T>();
        using (sqlcmd.Connection)
        {
            sqlcmd.Connection.Open();
            SqlDataReader sdr = sqlcmd.ExecuteReader();
            while (sdr.Read())
            {
                T newthing = new T();
                newthing.Create(sdr);
                results.Add(newthing);
            }
        }
        return results;
    }
}

public interface ICreatable
{
    void Create(SqlDataReader reader);
}

Downloading file from Physicalpath in asp.net

string filePath= ConfigurationManager.AppSettings["physicalpath"].ToString() + "Members\\filename";;
Response.AddHeader("Content-Disposition", "attachment;filename=\"" + filePath + "\"");
Response.TransmitFile(filePath);
Response.End();

Extracting Nupkg files using command line

Rename it to zip first then extract files as below 1.     Rename-Item -Path A_Package.nupkg -NewName A_Package.zip 2.     Make sure to repla...