如何获得主板序列号或处理器ID [英] how to get motherboard serial number or processord id

查看:150
本文介绍了如何获得主板序列号或处理器ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

im使一个简单的程序能够使用其唯一ID来识别PC,并将其保存到数据库中.
我找到了在C#上执行此操作的方法,但是Microsoft Visual C#无法连接到mySQL数据库,因此我想知道如何在Java上执行操作,
我正在使用netbeans,我认为这是有史以来最好的想法.

im making a simple program able to identify a pc using it unique ids and saving it to a database.
i found a way to do it on C#, but microsoft visual c# is not able to connect to a mySQL database, so i wan to know how to do it on java,
im using netbeans wich i think is the best ide ever

推荐答案

什么? Visual C#无法连接到mySQL数据库"?!请说实话,说:我没能力……",好吗?每天都有大量的人这样做.

您知道,我从不进行数据库开发,但是当我从头开始尝试mySQL时,只要查看文档,它立即对我有用.

-SA
What? Visual C# "is not able to connect to a mySQL database"?! Please, tell the truth, say: "I was not able…", OK? Enormous number of people do it every day.

You know, I never do database development, but when I tried mySQL from scratch, just looking at documentation, it worked for me immediately.

—SA


1.为ManagementObject添加名称空间
使用System.Management;
2.添加此功能,该功能将返回执行exe的计算机的序列号.

1. Add namespace for ManagementObject
using System.Management;
2. Add this founction which return the serial number of the machine on which the exe is executed.

private static string GetMotherboardSerialNumber()
{
String SerialNumber = "";
ManagementObjectSearcher mbs = new ManagementObjectSearcher("Select * from Win32_BaseBoard");
foreach (ManagementObject mo in mbs.Get())
{
    SerialNumber = mo["SerialNumber"].ToString().Trim();
}

return SerialNumber;

}


这篇关于如何获得主板序列号或处理器ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆