c# dataAdapter.fill()报错 至少有一个参数没有指定
privatevoidbutton3_Click(objectsender,EventArgse){stringMycon=@"Provider=Microsoft.Je...
private void button3_Click(object sender, EventArgs e)
{
string Mycon = @"Provider = Microsoft.Jet.OLEDB.4.0;" + @"Data Source=" +
System.Windows.Forms.Application.StartupPath + "\\FishManagement.MDB";
string Sql1 = "SELECT SUM=SUM(PScore),PGID FROM FMPA,FMPlayers where FMPA.PID=FMPlayers.PID GROUP BY PGID";
OleDbConnection Conn = new OleDbConnection(Mycon);
Conn.Open();
DataSet ds = new DataSet();
OleDbDataAdapter da = new OleDbDataAdapter(Sql1, Conn);
da.Fill(ds,"FMGA");
DataTable dt = ds.Tables["FMGA"];
DataRow dr;
int row = dt.Rows.Count;
float[] GroupScore = new float[row];
for (int i = 0; i < row; i++)
{
dr = dt.Rows[i];
GroupScore[i] = (float)dr["SUM"];
}
}
请各位高手帮个忙,我找了两天了。
我是想把数据库中的两个表连接,然后取出数据,所以FMGA不是已存在的表,只是一个临时参数,不知我说清楚了没有 展开
{
string Mycon = @"Provider = Microsoft.Jet.OLEDB.4.0;" + @"Data Source=" +
System.Windows.Forms.Application.StartupPath + "\\FishManagement.MDB";
string Sql1 = "SELECT SUM=SUM(PScore),PGID FROM FMPA,FMPlayers where FMPA.PID=FMPlayers.PID GROUP BY PGID";
OleDbConnection Conn = new OleDbConnection(Mycon);
Conn.Open();
DataSet ds = new DataSet();
OleDbDataAdapter da = new OleDbDataAdapter(Sql1, Conn);
da.Fill(ds,"FMGA");
DataTable dt = ds.Tables["FMGA"];
DataRow dr;
int row = dt.Rows.Count;
float[] GroupScore = new float[row];
for (int i = 0; i < row; i++)
{
dr = dt.Rows[i];
GroupScore[i] = (float)dr["SUM"];
}
}
请各位高手帮个忙,我找了两天了。
我是想把数据库中的两个表连接,然后取出数据,所以FMGA不是已存在的表,只是一个临时参数,不知我说清楚了没有 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询