开发者

compiler doesn't recognize the dataset (I added using the wizard or the .xsd files)

I created a DataSet object and DataLayer.cs class in root directory. In the DataLayer class I am using System.Data. But the compiler does not recognize my DataSet. The error asks me if I am missing a directive or an assembly reference. I dont think I am because intellisense does recognize the DataSet keyword, just not the DataSet that I created. The exact code is posted below, obviously you cannot see the DataSet in the Solution Explorer but trust me, it's there. Its exact name is dbCounters.xsd and it has the attached .xss thing. Also, everything is spelled correctly.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Configuration;
using System.Threading;
using System.Globalization;
using System.Data;
using System.Data.SqlClient;
using System.ComponentModel;
using System.Reflection;
using System.Web;

namespace Counters
{
    public class TwCounters
    {
         public void SaveCounters(CountersCache.Type type, DateTime currDateTime, string counter, long value) {

            using (dbCounters.AllCountersDataTable table = new dbCounters.AllCountersDataTable()) {
                table.UpsertAllCounters(System.Convert.ToBoolean(type), currDateTime, counter, value);
            }
            StartCounters();
        }
    }
}

I want to know is why it doesn't even recognize dbCounters, as far as I can tell it is there, it is spelled right, the Date Lay开发者_开发技巧er is referenced, the two files are even in the root directory, I have this same thing working in other projects so whats the problem here?


DataSet isn't a keyword. The compiler doesn't know anything about it specifically.

My guess is that your custom DataSet is in a different namespace - have a look at the designer-generated code, and add an appropriate using directive (or change the namespace to Counters to match this code).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜