DataSet 与 DataTable 赋值问题

Dimons Dimons 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
vs2005 下以下代码出错:
为什么会把错误,请大家解释下


using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
using System.Data;

namespace DataBaseAccess
{
class DataStructure
{
private DataStructure()
{
}

private void GetDate()
{
string strCon = "Data Source=localhost;Initial Catalog=pubs;Integrated Security=True;User ID =sa;Password =sa";
using (SqlConnection myConnection = new SqlConnection(strCon))
{
myConnection.Open();

SqlDataAdapter Adapter = new SqlDataAdapter("select * from authors", myConnection);

DataSet myDs = new DataSet();
Adapter.Fill(myDs);

DataTable myTable = myDs.Tables[0]; }
}
}
}





错误 1 无法将类型“System.Data.DataTable”隐式转换为“DataBaseAccess.DataTable” E:\SourcePrograme\VS2005ApplicationCode\DataBaseAccess\DataStructure.cs 27 37 DataBaseAccess
...全文
评论 8
收藏 已收藏
分享
返回顶部
Dimons
C# 111,129 成员 642,540 内容