X
xanrer
Guest
I tried to make this work without "where" when i do that it writes the data correctly however t writes it on the whole column.
After adding the "where" part it stopped writing data.
public int datNo;
private void DataGrdViewABCDSavDat_SelectionChanged(object sender, EventArgs e)
{
try
{
if (dataGrdViewABCDSavDat.Columns[dataGrdViewABCDSavDat.CurrentCell.ColumnIndex].Name == noDataGridViewTextBoxColumn.Name)
dataGrdViewABCDSavDat.CurrentCell.Selected = false;
datNo = dataGrdViewABCDSavDat.SelectedRows[0].Index;
}
catch (Exception)
{
}
}
private void BtnSavLoadEraGame_Click(object sender, EventArgs e)
{
OleDbConnection con = new OleDbConnection("Provider=Microsoft.ACE.Oledb.12.0;Data Source="+ curDir + "\\Save Data\\ABCDSaveData.accdb");
OleDbCommand cmd = new OleDbCommand();
OleDbDataAdapter da = new OleDbDataAdapter("SElect *from ABCDTable", con);
con.Open();
cmd.Connection = con;
datNo++;
cmd.CommandText = "update ABCDTable set SD='" + SaveToDBstr + "' where NO =" + datNo.ToString();
//cmd.Parameters.AddWithValue("@SD", SaveToDBstr);
cmd.ExecuteNonQuery();
con.Close();
}
SD and NO is in my database, it has only one table so no problem on that part.
Continue reading...
After adding the "where" part it stopped writing data.
public int datNo;
private void DataGrdViewABCDSavDat_SelectionChanged(object sender, EventArgs e)
{
try
{
if (dataGrdViewABCDSavDat.Columns[dataGrdViewABCDSavDat.CurrentCell.ColumnIndex].Name == noDataGridViewTextBoxColumn.Name)
dataGrdViewABCDSavDat.CurrentCell.Selected = false;
datNo = dataGrdViewABCDSavDat.SelectedRows[0].Index;
}
catch (Exception)
{
}
}
private void BtnSavLoadEraGame_Click(object sender, EventArgs e)
{
OleDbConnection con = new OleDbConnection("Provider=Microsoft.ACE.Oledb.12.0;Data Source="+ curDir + "\\Save Data\\ABCDSaveData.accdb");
OleDbCommand cmd = new OleDbCommand();
OleDbDataAdapter da = new OleDbDataAdapter("SElect *from ABCDTable", con);
con.Open();
cmd.Connection = con;
datNo++;
cmd.CommandText = "update ABCDTable set SD='" + SaveToDBstr + "' where NO =" + datNo.ToString();
//cmd.Parameters.AddWithValue("@SD", SaveToDBstr);
cmd.ExecuteNonQuery();
con.Close();
}
SD and NO is in my database, it has only one table so no problem on that part.
Continue reading...