Re: what is wring with this code?
- From: Göran Andersson <guffa@xxxxxxxxx>
- Date: Wed, 17 May 2006 11:12:48 +0200
You mean that the records added to the DataSet isn't added to the database table when you call Update?
That is because the records that are merged in have the RowState set to DataRowState.Unchanged, so the Update method ignores them.
I think that you have to add the DataRows to the DataTable (using the Add method of the Rows property) to be able to add them to the database table.
JIM.H. wrote:
Hello,.
With the following I am merging two dataset and I see the result in the datagrid but not in myTable.
Where might my problem be?
private void myMethod()
{
try
{
string strConn = ConfigurationSettings.AppSettings["connectionString"];
SqlConnection sqlConn = new SqlConnection(strConn);
SqlDataAdapter daRS = new SqlDataAdapter("SELECT * From myTable", sqlConn); SqlCommandBuilder cbRS = new SqlCommandBuilder(daRS); sqlConn.Open(); DataSet dsRS = new DataSet();
daRS.Fill(dsRS,"myTable");
PVS.myWS.Loader load = new PVS.myWS.Loader();
PVS.myWS.PVSTDS ds=load.getDataSet();
dsRS.Merge(ds,true);
dataGrid1.DataSource=dsRS;
daRS.Update(dsRS,"myTable"); sqlConn.Close();
catch (Exception ex)
{
throw ex;
}
}
- Prev by Date: Difficult datagrid
- Next by Date: programatically changing the .net version of virtual directory
- Previous by thread: Difficult datagrid
- Next by thread: programatically changing the .net version of virtual directory
- Index(es):
Relevant Pages
|