M
Magnus
Hi
I have a DataGrid that represents an whole databasetable. I fill the
grid with a DataSet, see below.
I wonder if it is possible to turn off the possibility to run Insert
commands for SqlCommandBuilder object when the GetUpdateCommand() is
run?
I dont want the user to be able to add rows in the table with the
SqlCommandBuilder
public DataSet fillDataSet()
{
DataSet returnSet = new DataSet();
string commandString = "select * from PriceList";
priceAdapter = new SqlDataAdapter(commandString, sqlConnection1);
priceAdapter.Fill(returnSet, "PriceList");
return returnSet;
}
public void updatePriceList(DataSet newPriceList)
{
sqlCommandBuilder.DataAdapter = priceAdapter;
priceAdapter.SelectCommand = new SqlCommand("select * from
PriceList");
priceAdapter.SelectCommand.Connection = sqlConnection1;
SqlCommand test = sqlCommandBuilder.GetUpdateCommand();
priceAdapter.UpdateCommand = test;
priceAdapter.Update(newPriceList.Tables["PriceList"]);
}
thanks,
Magnus
I have a DataGrid that represents an whole databasetable. I fill the
grid with a DataSet, see below.
I wonder if it is possible to turn off the possibility to run Insert
commands for SqlCommandBuilder object when the GetUpdateCommand() is
run?
I dont want the user to be able to add rows in the table with the
SqlCommandBuilder
public DataSet fillDataSet()
{
DataSet returnSet = new DataSet();
string commandString = "select * from PriceList";
priceAdapter = new SqlDataAdapter(commandString, sqlConnection1);
priceAdapter.Fill(returnSet, "PriceList");
return returnSet;
}
public void updatePriceList(DataSet newPriceList)
{
sqlCommandBuilder.DataAdapter = priceAdapter;
priceAdapter.SelectCommand = new SqlCommand("select * from
PriceList");
priceAdapter.SelectCommand.Connection = sqlConnection1;
SqlCommand test = sqlCommandBuilder.GetUpdateCommand();
priceAdapter.UpdateCommand = test;
priceAdapter.Update(newPriceList.Tables["PriceList"]);
}
thanks,
Magnus