Prasad Bolla's SharePoint Blog

Click Here to go through the Interesting posts within my Blog.

Click Here to go through the new posts in my blog.

Thursday, September 03, 2015

Search,Update and Delete using Entity Framework to SQL Server

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Update_EF : System.Web.UI.Page
{
    Contacts obj = new Contacts();
    ContactsDataContext db = new ContactsDataContext();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ddlID.DataSource = db.Contacts1;
            ddlID.DataBind();
            ddlID.Items.Insert(0, new ListItem("Select First Name"));
        }
    }
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        int ID = int.Parse(ddlID.SelectedItem.Value.ToString());
        Contacts con = db.Contacts1.SingleOrDefault(p => p.ID == ID);
        txtFirstName.Text = con.FIRSTNAME;
        txtLastName.Text = con.LASTNAME;
        txtContactNumber.Text = con.PHONENUMBER;
        lblMessage.Text = "Record Found";
    }
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        int ID = int.Parse(ddlID.SelectedItem.Value.ToString());
        Contacts con = db.Contacts1.SingleOrDefault(p => p.ID == ID);
        con.FIRSTNAME = txtFirstName.Text;
        con.LASTNAME = txtLastName.Text;
        con.PHONENUMBER = txtContactNumber.Text;
        db.SubmitChanges();
        txtFirstName.Text = "";
        txtLastName.Text = "";
        txtContactNumber.Text = "";
        ddlID.SelectedIndex = 0;
        lblMessage.Text = "Record Updated Successfully";
    }
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        int ID = int.Parse(ddlID.SelectedItem.Value.ToString());
        Contacts con = db.Contacts1.SingleOrDefault(p => p.ID == ID);
        db.Contacts1.DeleteOnSubmit(con);
        db.SubmitChanges();
        ddlID.SelectedIndex = 0;
        lblMessage.Text = "Record Deleted Successfully";
    }
}

Insertion into SQL Server using Entity Framework

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Insert_EF : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        Contacts obj = new Contacts();
        obj.FIRSTNAME = txtFirstName.Text;
        obj.LASTNAME = txtLastName.Text;
        obj.PHONENUMBER = txtContactNumber.Text;
        ContactsDataContext db = new ContactsDataContext();
        db.Contacts1.InsertOnSubmit(obj);
        db.SubmitChanges();
        txtFirstName.Text = "";
        txtLastName.Text = "";
        txtContactNumber.Text = "";
        lblMessage.Text = "Record Inserted Successfully";
    }
}

Saturday, August 15, 2015

Windows 10 and Windows KeyBoard

Hi All,

Recently i runned intio an issue with Windows 10. the word p is not working.

I thought its an keyboard issue. After i performed windows update and restarted the machine again the letter P started working.

Regards
Prasad Bolla

Powershell Script to Change the Display Name in SharePoint 2007

First, we need to load up the SharePoint Assemblies
> [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
Then we connect to our site collection
> $site = New-Object Microsoft.SharePoint.SPSite("http://spsite")
Then we get the root web of the site collection
> $web = $site.RootWeb
We then need to connect to the User Information List, which corresponds to the UserInfo table.
> $list = $web.Lists["User Information List"]
And now we can select out the individual user record we want to update.  We’ll filter on the Account field, which should match our Active Directory user information.
> $user = $list.Items | where {$_["Account"] -eq "DOMAIN\User"}
If you look at the details of the $user object, you’ll see it has both a Name and DisplayName property.  Don’t be fooled, however, these fields are read only.  The one we want is Title.
So, lets update the Title value for this user and save the changes.
> $user["Title"] = "Lastname, Firstname"
 
> $user.update()
To check, I go back to the site and refresh the User Information List page – and sure enough, the updated value is applied.
Finally, then, we need to clean up after ourselves and dispose of the SharePoint objects.
> $web.Dispose()
 
> $site.Dispose()

Friday, August 07, 2015

How to restart more than one machine remotely

sometimes machines might be in hung state and you are unable to login into the machine.

In such scenario you can use shutdown -i

The command will give you the window. Now follow the process with that window.

Saturday, August 01, 2015

Command to change App Pool .Net Framework 4.5

Test is an App Pool Name already created with other version framework.

C:\>cd %windir%\System32\inetsrv

C:\Windows\System32\inetsrv>appcmd set apppool /apppool.name: Test /managedRunti
meVersion:v4.5
APPPOOL object "Test" changed

C:\Windows\System32\inetsrv>

Thursday, July 30, 2015

WhatsApp had a Call Option in Windows10

After i upgraded to Windows10 I was able to get call option in my windows 10 mobile. Previously in windows 8.1 OS in my mobile i dont have call option.

How to Install Windows 10 in Windows8/Windows 8.1 Mobile

1. Go to store in Windows Phone
2. Search for windows insider
3. Now install it and follow the steps.
4. The phone will ask for reboot.
5. After that go to update and run the windows 10 setup.

How to make all programs run as Admin by default in Windows8, Windows 8.1, Windows Server 2012, Windows Server 2012 R2



Run PowerShell as Administrator and paste the following to disable UAC:

Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System" -Name "EnableLUA" -Value "0"
shutdown -r -t 0

The above commands will give you a full control on windows8/8.1/win 2012/win2012 R2 computer.

Installed Windows10 in my windows phone

HI All,

I had installed Windows10 in my windows phone. Look & feel is very nice but some things like Viber/My Tom and some things to type message/to click it is very hard to send message.

Please share your thoughts with Windows 10.

Regards
Prasad Bolla

Wednesday, July 15, 2015

There was an error encrypting or decrypting credentials. Either a credential update is currently being performed, or you must update the farm account credentials on this server before you can perform this task.

I got this error in SharePoint 2007 while trying to perform Password Update while using STSADM command. I followed the below steps to fix the issue.


  1. Login into your SharePoint site with FARM Credentials/Full Control User Credentials who have full control to SharePoint Central Admin site.
  2. Click Operations tab.
  3. In Operations page go to Global configuration.
  4. Under Global Configuration click on Timer Job Definitions link.
  5. In the timer job definitions page check for “Application Pool Credential Deployment job definition”.
  6. Deleting it will fix the issue.