“The .Net Framework installed on this machine does not meet the minimum required version: 4.5.50709” Visual Studio 2012

I wanted to develop a metro style application using Visual Studio 2012 on Windows 8 and I have already installed the Windows 8 release preview on my laptop! (Dual boot with Windows 7, you can see some screen shots here :)). I was trying to install the Visual Studio 2012 express edition and I have got the following error message! 🙂

I have spent few minutes on the web and found out there are some versions conflict, so we have to choose the correct version with operating system!  ( The latest Visual Studio RTM versions won’t install on Windows 8 Release Preview)

So I need to install either one of the RC versions of Visual Studio OR the 90 day evaluation version of Windows 8 version! I will choose the Microsoft Visual Studio Express 2012 RC for Windows 8!

That’s all guys! Happy Installing..!

References:

http://stackoverflow.com/questions/12027597/installing-visual-studio-ultimate-2012-on-windows-8-release-preview

http://connect.microsoft.com/VisualStudio/feedback/details/742858/the-net-framework-installed-on-this-machine-does-not-meet-the-minimum-required-version-4-5-50421

Advertisement

, , ,

1 Comment

“Input string was not in a correct format.” while installing SQL Server 2008

I have re-installed Windows 7 and other applications on my laptop this morning. While installing the SQL Server 2008, I have got the following error message.

I have selected all  the features including SSRS and SSIS, and the event log was showing like below.

After spending few minutes on the web, I realized the problem with my performance counters and I wanted to rebuild it on my laptop. Here is the steps to rebuild the performance counters!

Step 1: Open the command prompt (Make sure to Run As Administrator otherwise you will get an error :))

Step 2: Enter the “LODCTR /R” command and hit Enter key

You will be getting the following success message!

That’s all, try to install the SQL Server again, No problem at all!

Thanks /R

References:

http://blogs.technet.com/b/yongrhee/archive/2009/10/06/how-to-rebuild-performance-counters-on-windows-vista-server2008-7-server2008r2.aspx

, , , , , ,

4 Comments

Creating Business Data Catalog(BDC) using Application Definition File(ADF) – SharePoint 2007

Accessing the data from the database Or some other external data source and display on a SharePoint site is not a big deal these days. As developers we can create a web part and deploy it on the SharePoint but without writing any code, how we can display? BDC is the way to do so…!

Business Data Catalog

I am going to use very basic steps to create the BDC on my SharePoint 2007. If you want to create from the scratch without using any tools such as Application Definition Designer then you can follow this post.

These are the simple 4 steps I am going to use:

  1. Create a table and insert some values in SQL Server database
  2. Create an ADF using Application Definition Designer
  3. Import the ADF file into the Shared Service Provider(SSP)
  4. Configure the BDC on SharePoint
CREATE A TABLE AND INSERT SOME VALUES IN SQL SERVER DATABASE

You can see this post to create a sample database and we will retrieve this data using BDC. I have named Database1 and Table1

CREATE AN APPLICATION DEFINITION FILE (ADF) USING APPLICATION DEFINITION DESIGNER (ADD)

You can see this post to create an ADF sample and the file name is ADF_Table1

IMPORT THE ADF FILE INTO THE SHARED SERVICE PROVIDER (SSP)

Go to Central Administration (CA) and click your shared service provider (SSP) (Mine is SharedServices2)

Click Import application definition in the Business Data Catalog section

Click Browse, and select the ADF which we have created in the previous step


Keep other values in their default, and then click Import.


You will be getting this success message!

Click OK to finish the process!

If you want to manage the security just click the manage permissions and do so, that’s all we are done with the step 3! 🙂

CONFIGURE THE BDC ON SHAREPOINT

The last step is to use the Business Data List Web Part to show our data, go to any site and add a Business Data List Web Part to the page.

Open the tool pane

In the Business Data List task pane, click the browse button

The following Business Data Type Picker popup window will appear, you could see our Application Data File, Select the ADF_Table1_Instance

Click OK and publish the page, you can see the data on the web part!

That’s all guys! Happy BDC ing, we will see next BCS on SharePoint 2010! Ensoy..!!

References:

http://msdn.microsoft.com/en-us/library/ms563661(v=office.12).aspx

http://msdn.microsoft.com/en-us/library/bb410048(v=office.12).aspx

, , , , , , , , ,

Leave a comment

Create an Application Definition File (ADF) using Application Definition Designer (ADD)

What is ADF?

This is an XML file that describes your data source, how to connect to it, and the various queries, actions, and filters to display and sort the data. There are many way to create this ADF such as Application Definition Designer (ADD) and BDCMetaMan, I am going to use ADD to create the ADF.

Okay, we will see the steps here:

1. Installing and configuring the “Application Definition Designer” tool.

Please follow the steps in my previous post.

2. Creating the ADF using Application Definition Designer

Step 1: Open the ADD start –> programs –> Application Definition Designer

Step 2: You will be getting the designer and click on “Add LOB System”

Step 3: Then click on Connect to Database, you will be getting this dialog box to select the DB connection

Step 4: Choose connection type and enter connection string (I have created a database sample for this, you can see here)

Connection Type: SQL Server
Connection String: “Data Source=<ServerName>;Initial Catalog=Database1;Integrated Security=True”

Step 5: Click Connect button and you will be getting this window

Step 6: Click Add table tab and drag & drop the Database1.dbo.Table1 on the Design Surface

Step 7: Click Ok and then you will prompt to get the name of LOB, enter the name and click OK (I have given ADF_Table1)

Step 8: You will get the screen like this

Please note: We need to do few modifications to complete this task, otherwise we will be getting the following error when we use this ADF on the SharePoint1  😦

“There are no Business Data Types loaded in the Catalog – Business Data Type Picker”

 I have a post about this error in my previous article, please check it out.

Step 9: So Expand “FindAll_[Database1].[dbo].[Table1]” node under Methods and click Instances

In the Instances node click “FindAll_[Database1].[dbo].[Table1]_Instance” and you can see the properties of this method.

You can see the “MethodInstanceType” property has “IdEnumerator” method instead of the “Finder”. So just click the drop down list and select the Finder method.

Step 10: That’s all we done with the ADF now, just click the export button and get the file

You can see the ADF (xml) file now 🙂

Thanks R./

, , , ,

3 Comments

Create a simple Database and Table with some data in SQL Server

This is  for my testing and re-blogging purpose, I just want to create a database table and then insert few values. The reason I need this database, to create a BDC (Business Data Catalog) in SharePoint 2007. If anyone need to create a sample database then you can simply execute these scripts. 🙂

Step 1: Create a database

CREATE DATABASE Database1

Step 2: Create a Table

CREATE TABLE Table1(
Column1 int Primary Key NOT NULL,
Column2 varchar(10)
)

Step 3: Insert values into the table

INSERT INTO Table1 (Column1, Column2) VALUES (1, 'A')
INSERT INTO Table1 (Column1, Column2) VALUES (2, 'B')
INSERT INTO Table1 (Column1, Column2) VALUES (3, 'C')
INSERT INTO Table1 (Column1, Column2) VALUES (4, 'D')
INSERT INTO Table1 (Column1, Column2) VALUES (5, 'E')
INSERT INTO Table1 (Column1, Column2) VALUES (6, 'F')

That’s all, we will execute these two scripts (1 and then 2)

Script 1:

IF NOT EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'Database1')
CREATE DATABASE Database1
GO

Script 2:

Use Database1
GO

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'Table1'))
CREATE TABLE Table1(
Column1 int Primary Key NOT NULL,
Column2 varchar(10)
)
GO

INSERT INTO Table1 (Column1, Column2) VALUES (1, 'A')
INSERT INTO Table1 (Column1, Column2) VALUES (2, 'B')
INSERT INTO Table1 (Column1, Column2) VALUES (3, 'C')
INSERT INTO Table1 (Column1, Column2) VALUES (4, 'D')
INSERT INTO Table1 (Column1, Column2) VALUES (5, 'E')
INSERT INTO Table1 (Column1, Column2) VALUES (6, 'F')
GO

Copy and Paste these scripts in a Query Analyzer and execute from the menu or just press F5 to run the script!


Thanks. R./

,

4 Comments

Difference between ‘Shadowing’ and ‘Overriding’ (Shadowing vs Overriding) – C#

This is a very quick Tech-Tips..! Actually Shadowing is VB.Net concept, in C# this concept called hiding! We will see this chapter later. 🙂

Shadowing : Creating an entirely new method with the same signature as one in a base class.

Overriding: Redefining an existing method on a base class.

  • Both are used when a derived class inherits from a base class
  • Both redefine one or more of the base class elements in the derived class

If you want to read more regarding this, just follow this MSDN topic.


class A
 {
 public int M1()
 {
 return 1;
 }

 public virtual int M2()
 {
 return 1;
 }
 }

class B : A
 {
 public new int M1()
 {
 return 2;
 }

 public override int M2()
 {
 return 2;
 }
 }

class Program
 {
 static void Main(string[] args)
 {
 B b = new B();
 A a = (A)b;

 Console.WriteLine(a.M1()); //Base Method
 Console.WriteLine(a.M2()); //Override Method
 Console.WriteLine(b.M1());
 Console.WriteLine(b.M2());
 Console.Read();
 }
 }

The output is : 1, 2, 2, 2

, , , , ,

1 Comment

SecurityException was unhandled by user code – VSTA, C#, InfoPath 2007

I got this error, while I was developing a InfoPath form in VSTA (Visual Studio Tools for Applications 2008) . This was my enviornment:

  • Windows 7
  • VSTA 2008
  • InfoPath 2007

Scenario: I was trying to get the user information from Active Directory(AD) and then display in an InfoPath form. Here is the C# code I have written in the VSTA:

public void CTRL1_5_Clicked(object sender, ClickedEventArgs e)
 {
 string strUserName = System.Environment.UserName;

 string xpath2 = "/my:myFields/my:field1";
 XPathNavigator field2 = MainDataSource.CreateNavigator().SelectSingleNode(xpath2, NamespaceManager);
 field2.SetValue(GetOU(strUserName)); //Get Organization Unit(OU) from Acitve Directory(AD)
 }

This is the error message I have got: 😦

Solution: I have fixed this issue in a different situation, just read in my previous post.

Thanks. R./

Happy InfoPathing. 🙂

, , , ,

1 Comment

InfoPath cannot grant access to these files and settings because the form template is not fully trusted. For a form to run with full trust, it must be installed or digitally signed with a certificate – InfoPath 2007 forms Security Levels

After giving the Full Trust to the Form template (See here), we will be able to preview the InfoPath form and get information from other domains, or access files and settings on a user’s computer. But when we publish InfoPath form on SharePoint and try to access the from then you will be getting this error. 😦

Error:

Details:

Text format of the error:

Form template: file:///C:\Documents%20and%20Settings\RajanihanthV\Desktop\XmlProc\InfoPath\ADInfo.xsn</pre>
The form template is trying to access files and settings on your computer. InfoPath cannot grant access to these files and settings because the form template is not fully trusted. For a form to run with full trust, it must be installed or digitally signed with a certificate.

If we need to access the form from SharePoint, we need to be digitally signed the form even it is fully trusted. This is pretty simple, but we have to do this process after publishing the form on SharePoint only. Here are the steps.

Step 1: Navigate to the Document (form) Library, where your form published

Step 2: Click Settings on the Document Library Settings

Step 3: Advanced Settings

Step 4: Edit Template

Step 5: Click the Form Options on the Tools menu

Step 6: Click Sign this Form Template and create or select certificate, then OK

That’s all. You can try and see. 🙂

This will work only for you (author), If you want give access to all users you have to get the digital signature from 3rd party vendors and signed the form.

Thanks. R./

, , , ,

4 Comments

Request for the permission of type ‘System.DirectoryServices.DirectoryServicesPermission, System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ failed – InfoPath 2007 forms Security Levels

When I was trying to display user information from Active Directory(AD) in an InfoPath form, I have got an error message saying that I don’t have permissions to access the Directory services. 😦

Details of the error message:

Text format of the error:

System.Security.SecurityException
 Request for the permission of type 'System.DirectoryServices.DirectoryServicesPermission, System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' failed.
at Template2.FormCode.GetOU(String username)
at Template2.FormCode.CTRL1_5_Clicked(Object sender, ClickedEventArgs e)
at Microsoft.Office.InfoPath.Internal.ButtonEventHost.OnButtonClick(DocActionEvent pEvent)
at Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)

I have faced this kind of security level errors while creating a web parts using Active Directory(AD) and you can read this in my previous post.

Basically InfoPath provides three security levels for forms, they are:

  • Restricted
  • Domain
  • Full Trust

The security levels determine whether a form can access data on other domains, or access files and settings on a user’s computer. If you need more info about this, just click here.

When we design/create an InfoPath form, the minimum trust level will be assigned in-default and which is not enough to access the Directory Services. So we need to change the trust level to access the information.  These are the simple steps to change the Trust Levels in InfoPath,

Step 1: Open the Form template in Design Mode

Step 2: Click the Form Options on the Tools menu

Step 3: You will be getting the following window and the security levels automatically determined

Step 4: Unchecked the check box, give the permissions to ‘Full Trust’ and then click OK

That’s all, you can access the Directory Services programmatically and display in your InfoPath form.  Sometimes you will be getting another error after fixing this (probably after publishing to SharePoint), to solve this problem we just need to specify the digitally signed certificate for this form. Check out the error message here.

Thanks. R./

, , , , , , ,

2 Comments

Difference between ‘ref’ and ‘out’ parameters (ref vs out) – C#

  • Both are treated differently @ runtime but same in the compile time, so can’t be overloaded.
  • Both are passed by references except ‘ref’ requires that the variable to be initialized before passed.

ref:

class Program
 {
 static void M1(out int i)
 {
 i = 1;
 i += 1;
 }

static void Main(string[] args)
 {
 int j; //Not assigned
 M1(out j);
 Console.Write(j);
 Console.Read();
 }
 }
}

The output is : 2

out:

class Program
 {
 static void M1(ref int i)
 {
 i = 1;
 i += 1;
 }

 static void Main(string[] args)
 {
 int j=0; //Assigned
 M1(ref j);
 Console.Write(j);
 Console.Read();
 }
}

The output is same: 2, but we have to assigned the variable before used otherwise we will get an error.

, , , ,

2 Comments