The current build operation (build key Build Key[Microsoft.Practices.EnterpriseLibrary.Data.Database, Application]) failed: Unable to find the requested .Net Framework Data Provider. It may not be installed. (Strategy type Configured Object Strategy, index 2)

Unable to find the requested .Net Framework Data Provider. It may not be installed. (Strategy type ConfiguredObjectStrategy, index 2)

Then Paste the following code in Web.Config



<system.data>
    <DbProviderFactories>
      <add name="Oracle Data Provider for .NET" invariant="Oracle.DataAccess.Client" description="Oracle Data Provider for .NET" type="Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess, Version=2.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342"/>
    </DbProviderFactories>
  </system.data>


This DbProviderFactories should be matched with machine.config

which you can find in the following path

C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config

The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required

When  you are getting the below error.


SMTP server requires a secure connection or the client was not authenticated. The server response was : 5.5.1 Authentication Required.

Then you need to configure your email ID using Microsoft Dynamics CRM Email Router Configuration Manager.

Download Email Router Configuration Manager according to your system configuration
And Install it in your system, then configure your email( from which mail you want to send mails in code).

When you install the Microsoft Dynamics CRM Email Router Configuration Manager,

Click on


Then click on Configuration files-àNewà then you will get the following screen.



Under Access Credentials you need to specify email id and password( which email you want to configure) then click on publish then write the following code.

Email sending in C# gmail



using (MailMessage mm = new MailMessage("from@gmail.com""to@gmail.com"))
            {
                mm.Subject = "Subject Text";
                mm.Body = "Body Text";

                mm.IsBodyHtml = false;
                SmtpClient smtp = new SmtpClient();
                smtp.Host = "smtp.gmail.com";
                smtp.EnableSsl = true;

                NetworkCredential NetworkCred = new NetworkCredential("from@gmail.com""pwm");
                ServicePointManager.ServerCertificateValidationCallback =
                delegate(object s, X509Certificate certificate,
                         X509Chain chain, SslPolicyErrors sslPolicyErrors)
                { return true; };
                smtp.UseDefaultCredentials = false;
                smtp.Credentials = NetworkCred;
                smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
                smtp.Port = 587;
                smtp.Send(mm);
                //ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Email sent.');", true);
            }

How to modify datarow itemarray value with example code




The below example give a clear explanation on How to modify a datarow in C#.


          SqlConnection con = new SqlConnection(connectionstring);
            string query = "Select * from App_Branch";
            con.Open();
            SqlCommand cmd = new SqlCommand(query, con);
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataSet DS = new DataSet();
            da.Fill(DS);

            DataTable dt = new DataTable();
            foreach (DataRow item in DS.Tables[0].Rows)
            {
                if (item.ItemArray[2].ToString().Equals("0"))
                {
                    item["ColumnName"] = "Somthing";
//you can not give like this  item.ItemArray[4] = "Somthing";
                }
                else
                {
                    item["ColumnName"] = "Somthing";
                }
                dt.Rows.Add(item.ItemArray);

            }





How to get values of Form1.cs into another .cs file


Following is my Form1, Here I am Passing Form1 Textbox value to Form2 TextBox.




I want to send the Form1 Value to Form2 textbox as



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ValuesPassingFromformtoform
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

      
        private void button1_Click(object sender, EventArgs e)
        {
            Form2 f2 = new Form2(textBox1.Text);           
            f2.Show();
        }
    }
}

This is my Form2, Whenever I clicked on Form1 button, textbox value will send to the Form2's Textbox value.


 



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ValuesPassingFromformtoform
{
    public partial class Form2 : Form
    {
        public Form2(string value)
        {
            InitializeComponent();
            textBox2.Text = value;
        }
      
    }
}