我在 SQLServer 类中有这段代码
class sqlServer
{
public string uName,pWord;
public SqlConnection connection;
public sqlServer(string name, string pass)
{
this.uName = name;
this.pWord = pass;
connection = new SqlConnection("user id=" + uName + ";" + "password=" + pWord + ";" + "server=SERVER\\SQLSERVER2008;"
+ "database=school; " + "connection timeout=30");
}
--------------------
我在另一个名为 mainWindow 的类中创建了这个类的对象,我想将此对象作为另一个类的参数传递。其中一个是收银员菜单,这些代码在这里......
它给出错误错误
可访问性不一致:字段类型“school.sqlServer”的可访问性低于字段“school.cashierMenu.db” D:\Projects\school\school\cashierMenu.xaml.cs 21 26 school
主菜单部分...
db = new sqlServer(txtBxName.Text, txtBxPassword.Password);
if (db.connect())
{
db.disconnect();
MessageBox.Show("Fasasaild");
}
else
{
MessageBox.Show("Faild");
}
收银员菜单构造函数
public partial class cashierMenu : Window
{
public sqlServer db;
public cashierMenu(sqlServer database)
{
InitializeComponent();
this.db = database;
}
}
我怎么能出去……