Monday, March 3, 2014

Test Your Love


Test Your Love How much it is pass or acquire marks.

http://lovetest.singlessalad.com/?cid=4581&ax=1&clickid=0053618368096869236&ext_inv_code=103883&dfpid=102103883&oid=7813

Tuesday, February 25, 2014

Kill All Process in database sql while restoring



If there is any problem that database currently in use and you are not able to restore database than you can run this query for block all processes currently running.

Use Master
Go

Declare @dbname sysname

Set @dbname = 'CDM_HVMS'

Declare @spid int
Select @spid = min(spid) from master.dbo.sysprocesses
where dbid = db_id(@dbname)
While @spid Is Not Null
Begin
        Execute ('Kill ' + @spid)
        Select @spid = min(spid) from master.dbo.sysprocesses
        where dbid = db_id(@dbname) and spid > @spid
End
print 'done'

Monday, October 21, 2013

Check Existing record by join two tables using Linq

//Use this code to check existing record from two tables using Linq .

Chrome_VINEquipment existequipment = db.Chrome_VINEquipments.Where(x => x.VINPatternID == VinPatternID && db.WS_GenericEquipments.Any(c => c.StyleId == car.StyleId)).FirstOrDefault();

Monday, July 8, 2013

Find Item in DropDownlist


Find Item in dropdown if item find then selected or its ignored .with this code.....
ddlBody.SelectedIndex = ddlBody.Items.IndexOf(ddlBody.Items.FindByValue(Convert.ToString(lst[0].BodyId)));

Tuesday, June 25, 2013

Update row by row any field without cursor



WITH myTable2 AS
    (
    SELECT vinid, ROW_NUMBER() OVER (ORDER BY vinid) AS sequence
    FROM VehicleDescription
    )
   


UPDATE genericequipment
SET VinID = VehicleDescription.vinid
FROM VehicleDescription
JOIN genericequipment on VehicleDescription.VinPattern = genericequipment.vinPattern;

Saturday, March 9, 2013

Custom Paging in Datalist or repeater


This is a very simple custom paging technique for a developer where ha can do paging in datalist and repeater in only 5 minutes.enjoy code.....

  public void BindPhoto()
        {
            GalleryModuleController objCommentModules = new GalleryModuleController();

            List cmi;
            cmi = objCommentModules.PhotoList(0);
            if (cmi.Count > 0)
            {
                dlphotogallery.DataSource = cmi;
                dlphotogallery.DataBind();
                pds.DataSource = cmi;
                pds.AllowPaging = true;

                //to set the paging change the number 3 to your desired value

                pds.PageSize = 4;

                pds.CurrentPageIndex = CurrentPage;

                lnkbtnNext.Enabled = !pds.IsLastPage;

                lnkbtnPrevious.Enabled = !pds.IsFirstPage;

                dlphotogallery.DataSource = pds;

                dlphotogallery.DataBind();

                doPaging();
            }
        }


        protected void lnkbtnPrevious_Click(object sender, EventArgs e)
        {

            CurrentPage -= 1;
            BindPhoto();

        }

        protected void lnkbtnNext_Click(object sender, EventArgs e)
        {

            CurrentPage += 1;

            BindPhoto();

        }

        protected void dlPaging_ItemCommand(object source, DataListCommandEventArgs e)
        {

            if (e.CommandName.Equals("lnkbtnPaging"))
            {
                CurrentPage = Convert.ToInt16(e.CommandArgument.ToString());
                BindPhoto();
            }

        }

        protected void dlPaging_ItemDataBound(object sender, DataListItemEventArgs e)
        {

            LinkButton lnkbtnPage = (LinkButton)e.Item.FindControl("lnkbtnPaging");
            if (lnkbtnPage.CommandArgument.ToString() == CurrentPage.ToString())
            {
                lnkbtnPage.Enabled = false;
                lnkbtnPage.Font.Bold = true;
            }

        }

        public int CurrentPage
        {
            get
            {
                if (this.ViewState["CurrentPage"] == null)

                    return 0;

                else

                    return Convert.ToInt16(this.ViewState["CurrentPage"].ToString());

            }

            set
            {

                this.ViewState["CurrentPage"] = value;

            }

        }



        private void doPaging()
        {

            DataTable dt = new DataTable();

            dt.Columns.Add("PageIndex");

            dt.Columns.Add("PageText");

            for (int i = 0; i < pds.PageCount; i++)
            {

                DataRow dr = dt.NewRow();

                dr[0] = i;

                dr[1] = i + 1;

                dt.Rows.Add(dr);

            }

            dlPaging.DataSource = dt;

            dlPaging.DataBind();

        }