C # Getting and updating the notebooks table

Source: Internet
Author: User
Asp.net updates the client-side Injection Table, which involves security issues. Therefore, it is impossible to retrieve and update the client-side. In this case, the user can only retrieve and update the phone number Injection Table.

Using Microsoft. Win32; ///   <Summary>
/// Get the email name
///   </Summary>
String Scomputername = System. environment. machinename;
// Note the path "SOFTWARE \ cmweb" in the examples table 」
Const   String Sregistrypath =   @" Software \ cmweb " ;

1. Orders are used to add the orders table. ///   <Summary>
/// See the content in the "Notice" table.
///   </Summary>
Void Getregistry ()
{
// Open a designated Injection Table
Rkkey = Registry. localmachine. opensubkey (sregistrypath );
If (Rkkey ! =   Null )
{
// See the content in the "Notice" table.
String Sregistryvalue = Rkkey. getvalue (sregistrykey, "" ). Tostring ();
}
}

2. Create a sequence table ///   <Summary>
/// Volume creation and attention table content
///   </Summary>
Private   Void Createregistry ()
{
// Obtain the master region of "HKEY_LOCAL_MACHINE \ SOFTWARE ".
Registrykey rkrootkey = Registry. localmachine. opensubkey ( @" Software " , True );
If (Rkrootkey ! =   Null )
{
// Create cmweb when cmweb does not exist
If (Array. indexof (rkrootkey. getsubkeynames (), " Cmweb " ) <   0 )
{
Rkrootkey. createsubkey ( " Cmweb " );
}
// Obtain "HKEY_LOCAL_MACHINE \ SOFTWARE \ cmweb ".
Rkkey = Registry. localmachine. opensubkey (sregistrypath, True );
If (Rkkey ! =   Null )
{
// Email name
String Sregvalue = Scomputername;

//Shard creation value
Rkkey. setvalue (sregistrykey, sregvalue );
}
}
}

3. Update the notebooks table
///   <Summary>
/// Update the notebooks table
///   </Summary>
Void Updateregistry ()
{
// Obtain the master region of "HKEY_LOCAL_MACHINE \ SOFTWARE ".
Registrykey rkrootkey = Registry. localmachine. opensubkey ( @" Software " , True );
If (Rkrootkey ! =   Null )
{
// Cmweb creation does not exist when "cmweb" expires
If (Array. indexof (rkrootkey. getsubkeynames (), " Cmweb " ) <   0 )
{
// Shard name
Rkrootkey. createsubkey ( " Cmweb " );
}
// Obtain "HKEY_LOCAL_MACHINE \ SOFTWARE \ cmweb ".
Rkkey = Registry. localmachine. opensubkey (sregistrypath, True );
If (Rkkey ! =   Null )
{
// Email name
String Sregvalue = Scomputername;

// watermark creation watermark value
rkkey. setvalue (sregistrykey, sregvalue);
}< BR >}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.