Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# get regedit value

try
{
  	string reqURL = "SoftwareWow6432NodeMySQL ABMySQL ConnectorNet";
    RegistryKey key = Registry.LocalMachine.OpenSubKey(reqUrl);
    if (key != null)
    {
        Object o = key.GetValue("Version");
        if (o != null)
        {
            Version version = new Version(o as String);  
			//"as" because it's REG_SZ...otherwise ToString() might be safe(r)
            
			Version broken = new Version("6.7.4");
          
          	//This is where the error is occuring
            if (version.Equals.(broken)) 
            {
              	var section = ConfigurationManager.GetSection("system.data"); 
                DataSet dataSet = section as DataSet;

                DataView vi = dataSet.Tables[0].DefaultView;
                vi.Sort = "Name";
                if (vi.Find("MySql") == -1)
                {
                    dataSet.Tables[0].Rows.Add(
						"MySql",
						"MySql.Data.MySqlClient",
						"MySql.Data.MySqlClient",
                        typeof(MySqlClientFactory).AssemblyQualifiedName
                    );
                }

            }

        }
    }
}
catch (Exception ex)
{
  	//just for demonstration...it's always best to handle specific exceptions
     //react appropriately
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: how to make a enemy in unity 
Csharp :: C# Bitwise and Bit Shift operator 
Csharp :: how to add colider in obj in unity 2020 
Csharp :: MailChimp C# Api calls 
Csharp :: ik not working unity 
Csharp :: wie macht man eine schleife in c# 
Csharp :: C# a program to reverse each word in the given string. 
Csharp :: C# webclient immitate browser 
Csharp :: c# an object on upper level cannot be added to an object 
Csharp :: laravel get current url 
Html :: qs cdn 
Html :: html tab icon 
Html :: how to open link in a new tab 
Html :: cdk bootstrap 
Html :: twig count array 
Html :: open vsc with admin rights linux 
Html :: refresh button html 
Html :: how to change website icon html 
Html :: how to link your js file to html 
Html :: how to link new tab in html button 
Html :: html inbed youtube 
Html :: confuse your browser in html 
Html :: vertical break html 
Html :: auto update copyright year html 
Html :: meta refresh url 
Html :: how to add an audio in html 
Html :: HTML Links - Hyperlinks 
Html :: syntax for ngfor 
Html :: min number input html 
Html :: html mailto link with content 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =