G
Guest
When I use a stored procedure to insert data into a table and when the
Datagrid refreshes two new columns are added. The dataSet is set up with one
table with NO columns defined. Please help me on this. I have screen shots of
the before and after.
Here is the code:
sqlCommand.CommandType = CommandType.StoredProcedure;
sqlCommand.CommandText = SQLInsertSP;
sqlCommand.Parameters.Add("@aid",SqlDbType.Int,4);
sqlCommand.Parameters.Add("@type",SqlDbType.VarChar,50);
sqlCommand.Parameters["@aid"].Value = tAID;
sqlCommand.Parameters["@type"].Value = tValue;
sqlADBAdapt.InsertCommand = sqlCommand;
//This is the point where the Insert Statement is working but its adding two
new columns
sqlADBAdapt.Update(dataSet1);
sqlCommand.Parameters.Clear();
sqlCommand.CommandType = CommandType.StoredProcedure;
sqlCommand.CommandText = SQLSelectSP;
try{
sqlADBAdapt.SelectCommand = sqlCommand;
sqlADBAdapt.Fill(dataSet1.Tables[0]);
}
catch(SqlException ae){
MessageBox.Show(ae.Message.ToString());
}
dataGrid1.DataSource = dataTable1;
dataGrid1.ReadOnly=true;
Datagrid refreshes two new columns are added. The dataSet is set up with one
table with NO columns defined. Please help me on this. I have screen shots of
the before and after.
Here is the code:
sqlCommand.CommandType = CommandType.StoredProcedure;
sqlCommand.CommandText = SQLInsertSP;
sqlCommand.Parameters.Add("@aid",SqlDbType.Int,4);
sqlCommand.Parameters.Add("@type",SqlDbType.VarChar,50);
sqlCommand.Parameters["@aid"].Value = tAID;
sqlCommand.Parameters["@type"].Value = tValue;
sqlADBAdapt.InsertCommand = sqlCommand;
//This is the point where the Insert Statement is working but its adding two
new columns
sqlADBAdapt.Update(dataSet1);
sqlCommand.Parameters.Clear();
sqlCommand.CommandType = CommandType.StoredProcedure;
sqlCommand.CommandText = SQLSelectSP;
try{
sqlADBAdapt.SelectCommand = sqlCommand;
sqlADBAdapt.Fill(dataSet1.Tables[0]);
}
catch(SqlException ae){
MessageBox.Show(ae.Message.ToString());
}
dataGrid1.DataSource = dataTable1;
dataGrid1.ReadOnly=true;