S
sujatha
I am fetching data into a dataset from one data source and trying to
update it to another data source using adapter.update method but this
doesnt work. Doesnt give me an error either!!
my code
MiningDataSet = new DataSet();
DataSet TempDataSet = new DataSet();
DataTable ClusterTable = MiningDataSet.Tables.Add ("Cluster");
ClusterTable.Columns.Add ("NODE_UNIQUE_NAME");
ClusterTable.Columns.Add ("NODE_CAPTION" );
DataColumn NodeDist = ClusterTable.Columns.Add
("NODE_DISTRIBUTION",System.Type.GetType("System.Int32") );
NodeDist.AutoIncrement = true;
DataTable ClusterDistTable =
MiningDataSet.Tables.Add("ClusterDist");
ClusterDistTable.Columns.Add("ATTRIBUTE_NAME");
ClusterDistTable.Columns.Add("ATTRIBUTE_VALUE");
ClusterDistTable.Columns.Add("SUPPORT");
ClusterDistTable.Columns.Add("PROBABILITY");
ClusterDistTable.Columns.Add("VARIANCE");
ClusterDistTable.Columns.Add("VALUETYPE");
DataColumn NodeDistChild =
ClusterDistTable.Columns.Add("NODE_DISTRIBUTION" );
NodeDistChild.DataType = System.Type.GetType("System.Int32");
MiningDataSet.Relations.Add
("NodeDistribution",NodeDist,ClusterDistTable.Columns["NODE_DISTRIBUTION"]);
SelectCommand.CommandType = CommandType.Text ;
SelectCommand.CommandText = "SELECT
NODE_UNIQUE_NAME,NODE_CAPTION,NODE_DISTRIBUTION FROM
[mystores].content";
Adapter.TableMappings.Add ("Table","Cluster");
Adapter.TableMappings.Add
("TableNODE_DISTRIBUTION","ClusterDist");
Adapter.Fill(MiningDataSet);
InsertCommand.CommandType = CommandType.Text ;
InsertCommand.CommandText = "INSERT INTO
Cluster(NODE_UNIQUE_NAME,NODE_CAPTION,NODE_DISTRIBUTION) VALUES
(?,?,?)";
InsertCommand.Parameters.Add
("NODE_UNIQUE_NAME",OleDbType.VarChar,50,ClusterTable.Columns["NODE_UNIQUE_NAME"].ToString()
);
InsertCommand.Parameters.Add
("NODE_CAPTION",OleDbType.VarChar,50,ClusterTable.Columns["NODE_CAPTION"].ToString());
InsertCommand.Parameters.Add
("NODE_DISTRIBUTION",OleDbType.VarChar
,50,ClusterTable.Columns["NODE_DISTRIBUTION"].ToString());
CloseDBConnection();
Conn.ConnectionString = "Provider=SQLOLEDB.1;Persist Security
Info=False;User ID=sa;pwd=sa12;initial Catalog=IXAppDB;Data
Source=nexdell-05";
OpenDBConnection();
InsertCommand.Connection = Conn;
TempDataSet = MiningDataSet.Clone();
//InsertCommand.CommandText ="select * from organization";
//InsertCommand.ExecuteNonQuery ();
Adapter.Update(TempDataSet,"ClusterDist");
update it to another data source using adapter.update method but this
doesnt work. Doesnt give me an error either!!
my code
MiningDataSet = new DataSet();
DataSet TempDataSet = new DataSet();
DataTable ClusterTable = MiningDataSet.Tables.Add ("Cluster");
ClusterTable.Columns.Add ("NODE_UNIQUE_NAME");
ClusterTable.Columns.Add ("NODE_CAPTION" );
DataColumn NodeDist = ClusterTable.Columns.Add
("NODE_DISTRIBUTION",System.Type.GetType("System.Int32") );
NodeDist.AutoIncrement = true;
DataTable ClusterDistTable =
MiningDataSet.Tables.Add("ClusterDist");
ClusterDistTable.Columns.Add("ATTRIBUTE_NAME");
ClusterDistTable.Columns.Add("ATTRIBUTE_VALUE");
ClusterDistTable.Columns.Add("SUPPORT");
ClusterDistTable.Columns.Add("PROBABILITY");
ClusterDistTable.Columns.Add("VARIANCE");
ClusterDistTable.Columns.Add("VALUETYPE");
DataColumn NodeDistChild =
ClusterDistTable.Columns.Add("NODE_DISTRIBUTION" );
NodeDistChild.DataType = System.Type.GetType("System.Int32");
MiningDataSet.Relations.Add
("NodeDistribution",NodeDist,ClusterDistTable.Columns["NODE_DISTRIBUTION"]);
SelectCommand.CommandType = CommandType.Text ;
SelectCommand.CommandText = "SELECT
NODE_UNIQUE_NAME,NODE_CAPTION,NODE_DISTRIBUTION FROM
[mystores].content";
Adapter.TableMappings.Add ("Table","Cluster");
Adapter.TableMappings.Add
("TableNODE_DISTRIBUTION","ClusterDist");
Adapter.Fill(MiningDataSet);
InsertCommand.CommandType = CommandType.Text ;
InsertCommand.CommandText = "INSERT INTO
Cluster(NODE_UNIQUE_NAME,NODE_CAPTION,NODE_DISTRIBUTION) VALUES
(?,?,?)";
InsertCommand.Parameters.Add
("NODE_UNIQUE_NAME",OleDbType.VarChar,50,ClusterTable.Columns["NODE_UNIQUE_NAME"].ToString()
);
InsertCommand.Parameters.Add
("NODE_CAPTION",OleDbType.VarChar,50,ClusterTable.Columns["NODE_CAPTION"].ToString());
InsertCommand.Parameters.Add
("NODE_DISTRIBUTION",OleDbType.VarChar
,50,ClusterTable.Columns["NODE_DISTRIBUTION"].ToString());
CloseDBConnection();
Conn.ConnectionString = "Provider=SQLOLEDB.1;Persist Security
Info=False;User ID=sa;pwd=sa12;initial Catalog=IXAppDB;Data
Source=nexdell-05";
OpenDBConnection();
InsertCommand.Connection = Conn;
TempDataSet = MiningDataSet.Clone();
//InsertCommand.CommandText ="select * from organization";
//InsertCommand.ExecuteNonQuery ();
Adapter.Update(TempDataSet,"ClusterDist");