写到类里面,方法体外面,如果你要在其他类调用那就写成静态的C#codepublicstaticOleDbConnectionTheConnection;用的时候直接类名.TheConnection;例如:类名.TheConnection.Open();