Sunday, March 30, 2025

Friday, March 28, 2025

How to add string of array to data source of grid

 public class File1

{

    public string FileName { get; set; }

}


  List<File1> Files = new List<File1>();


if (Directory.GetFiles(Server.MapPath("/uploads/")).Count() > 0)

        {

            foreach (var item in Directory.GetFiles(Server.MapPath("/uploads/")))

            {

                

                Files.Add(new File1 { FileName = item });

                Response.Write(item);

                

                grdTest.DataSource = Files;


                grdTest.DataBind();

            }


        }

How to find the dicrectory path of website

 Response.Write(Request.PhysicalApplicationPath );   //output C:\Users\Yash User\Documents\Visual Studio 2012\WebSites\YashWebsiteWebForm\

        Response.Write(Request.PhysicalPath + Environment.NewLine); // output C:\Users\Yash User\Documents\Visual Studio 2012\WebSites\YashWebsiteWebForm\Default3.aspx


        Response.Write(Request.RawUrl );  //output  /Default3.aspx

        Response.Write(Request.Url); // output http://localhost:49730/Default3.aspx


Server.MapPath ("");   //output C:\Users\Yash User\Documents\Visual Studio 2012\WebSites\YashWebsiteWebForm


Wednesday, March 26, 2025

How to write query with query builder in SQL server

 > Open Sql server management studio

> Right click on editor and click on "Design query in editor"

> And right click in that to change insert update or delete query.

How to create a new table with select query in SQL

 SELECT   [Date]

      ,[SchemeNo] ,[Commission]

INTO        test3

FROM     PolicyDetails