可以啊!
using System.Data;
using System.Data.SqlClient;……SqlConnection  //数据库连接;
SqlDataAdapter  //适配器;
SqlCommand  //数据库命令;
DataSet  //数据集;
DataTable  //数据表;
……

解决方案 »

  1.   

    当然可以,你可以参考一下MSDN,其实你把win服务当作一个类好了,然后引用别的using System.Data;
    using System.Data.SqlClient;名此空间即可。
      

  2.   

    部分源码:
    using System.Data;
    using System.Data.OleDb;
    ……
    OleDbConnection conn=new OleDbConnection(this.source);
    OleDbDataAdapter da=new OleDbDataAdapter("select * from category",conn);
    try
    {
    da.Fill(ds,"category");
    comboBox_categoryName.DataSource=ds.Tables["category"];
    comboBox_categoryName.DisplayMember="categoryName"; da.SelectCommand.CommandText="select * from field";
    da.Fill(ds,"field");
    comboBox_field.DataSource=ds.Tables["field"];
    comboBox_field.DisplayMember="field";
    }
    catch(Exception ex)
    {
    MessageBox.Show(ex.MessageMessageBoxButtons.OK,MessageBoxIcon.Error);
    }
    finally
    {
    conn.Close();
    } getASCIITable();
    dataGrid1.DataSource=null;
    dataGrid1.DataSource=ds.Tables["ascii"];
    dataGrid1.CaptionText="ASCII码表:";
    dataGrid1.ReadOnly=true;
    dataGrid1.Update();
      

  3.   

    注:数据集ds为全局变量,DataSet ds=new DataSet();