我有一个下面给出的课程,
public class TryDataContext : DataContext
{
public Table<Data> Datas
{
get
{
return this.GetTable<Data>();
}
}
public TryDataContext(string connectionString) : base (connectionString)
{
}
}
我的 app.xaml.cs 页面是,
public void Button_Click_1(object sender, RoutedEventArgs e)
{
using (TryDataContext Empdb = new TryDataContext(strConnectionString))
{
if (Empdb.DatabaseExists() == false)
{
Empdb.CreateDatabase();
MessageBox.Show("Database Created Successfully!!!");
}
else
{
MessageBox.Show("Database already exists!!!");
}
}
}
现在,当我编译项目时,我收到一条错误消息,
Error 1 The type or namespace name 'TryDataContext' could not be found (are you missing a using directive or an assembly reference)
我应该怎么做才能摆脱这个问题??仅供参考:类 TryDataContext 位于另一个名为TryDataContext.cs的文件中。