Ich habe eine Gruppe von Zeichenfolgen mit dem Namen temp1 in dieser Liste habe ich eine Gruppe von Wörtern für jedes Wort berechne ich N00, N01, N10, N11, MI und am Ende wirft es eine Ausnahme Aktualisierung konnte TableMapping['sample'] oder DataTable 'sample' nicht finden.. Bitte helfen
DataSet dsSelectAll = new DataSet();
SqlCommand cmdSelectAll = new SqlCommand("select * from sample", con);
SqlDataAdapter daSelectAll = new SqlDataAdapter(cmdSelectAll);
SqlCommandBuilder scb = new SqlCommandBuilder(daSelectAll);
daSelectAll.FillSchema(dsSelectAll,SchemaType.Mapped, "sample");
foreach (string ri in temp1)
{
//for (int a3 = 0; a3 < ssl.Count; a3++)
{
cmdT.CommandText = @"SELECT * FROM [vijay].[dbo].[sample] where keyword in ('y','" + ri + "')";
// ds.Tables.Clear();
da.Fill(ds);
// Reihe 1 :: 1 0 0 1 0 0
// Reihe 2:: 2 7 0 0 0 1
int N00 = 0;
int N01 = 0;
int N10 = 0;
int N11 = 0;
for (int i = 0; i < ds.Tables[0].Columns.Count; i++)
{
// N00
if (ds.Tables[0].Rows[0][i].ToString() == "0")
{
if (ds.Tables[0].Rows[1][i].ToString() == "0")
{
N00++;
}
}
// N01
if (ds.Tables[0].Rows[0][i].ToString() == "1")
{
if (ds.Tables[0].Rows[1][i].ToString() == "0")
{
N01++;
}
}
// N10
if (ds.Tables[0].Rows[0][i].ToString() == "0")
{
if ((ds.Tables[0].Rows[1][i].ToString()) !="0")
{
N10++;
}
}
// N11
if (ds.Tables[0].Rows[0][i].ToString() == "1")
{
if (ds.Tables[0].Rows[1][i].ToString()!="0")
{
N11++;
}
}
}
//if (a3 == (ssl.Count - 1))
{
//SqlCommand ins = new SqlCommand("update sample set N00=" + N00 + " where KeyWord='" + ri + "'", con);
//ins.ExecuteNonQuery();
DataRow[] drSelectAll = ds.Tables[0].Select("KeyWord='" + ri + "'");
drSelectAll[0]["N00"] = N00;
drSelectAll[0]["N01"] = N01;
drSelectAll[0]["N10"] = N10;
drSelectAll[0]["N11"] = N11;
double n = N00 + N11 + N10 + N01;
double w1 = Convert.ToDouble((N11 / n) * (Math.Log(((n * N11) / ((N10 + N11) * (N01 + N11))), 2)));
double w2 = Convert.ToDouble((N01 / n) * (Math.Log(((n * N01) / (((N01 + N00) * (N01 + N11)))), 2)));
double w4 = Convert.ToDouble((N00 / n) * (Math.Log(((n * N00) / (((N00 + N01) * (N00 + N10)))), 2)));
double w3 = Convert.ToDouble((N10 / n) * (Math.Log(((n * N10) / (((N10 + N11) * (N00 + N10)))), 2)));
if (w1.ToString() == "NaN")
{
w1 = 0;
}
if (w2.ToString() == "NaN")
{
w2 = 0;
}
if (w3.ToString() == "NaN")
{
w3 = 0;
}
if (w4.ToString() == "NaN")
{
w4 = 0;
}
double ni = w1 + w2 + w3 + w4;
drSelectAll[0]["MI"] = ni;
ds.Tables[0].Rows.Add(drSelectAll);
}
}
}
try
{
daSelectAll.Update(ds, "sample");
}
catch (Exception)
{
throw;//Fehler
}
Fehler:Aktualisierung konnte TableMapping['sample'] oder DataTable 'sample' nicht finden.