获取数据集和数据表keywrd的错误。 [英] getting error on dataset and datatable keywrd.

查看:68
本文介绍了获取数据集和数据表keywrd的错误。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

public DataSet ConnectDataBaseReturnDS(string Query)
   {
       ds = new DataSet();
       con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\M\Documents\Visual Studio 2010\Projects\fc 28-3\fc\App_Data\fc.mdf;Integrated Security=True;User Instance=True");
        cmd.CommandText = Query;
       cmd.Connection = con;
      da = new SqlDataAdapter(cmd);
      da.Fill(ds);
       con.Open();
       cmd.ExecuteNonQuery();
       con.Close();
    }





在关键字数据集,sqldataadpter等上出现错误...我已经为它定义了命名空间。 bt仍然会收到错误..不要知道要做什么..

请帮我解决。

我有没有错误????



错误显示是



error ocured on keyword dataset,sqldataadpter,and etc... i''ve define namespace for it.. bt still getting error.. dont knw waht to do..
plz help me out.
is there mistake any i have made????

the error dispaying is

expected class delegate, enum ,interface or struct 

推荐答案

通过查看你提供的错误,似乎函数是在类边界之外定义的(检查你的括号)。



任何函数都应该只定义在类委托,枚举,接口或结构的边界内。
By looking into error you provided it seems that the function is defined outside the class boundary(check your parentheses).

Any function should be defined only inside the boundaries of class delegate, enum ,interface or struct.


您是否添加了System.Data命名空间?



我认为你错过了这个名称空间。



Have you added System.Data namespace?

I think you are missing this namepace.

using System.Data;





添加上面的命名空间并检查。



Add the above namespace and check.


这篇关于获取数据集和数据表keywrd的错误。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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