Click here to Skip to main content
15,883,901 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a one source table,in which data is inserted when the feed is over. my job is to monitor that table,if any new record inserted i need to call the stored procedure from my (c# program) which has some business logic to it
I use the access database
..

[edit]Spurious code block removed - OriginalGriff[/edit]
Posted
Updated 24-Jan-12 22:30pm
v2

Please try this code if you are using a datatable

private void UpdateDataTable(DataTable table,
OleDbDataAdapter myDataAdapter)
{
DataTable xDataTable = table.GetChanges();
// Check the DataTable for errors.
if (xDataTable.HasErrors)
{
// Insert code to resolve errors.
}
// After fixing errors, update the database with the DataAdapter
myDataAdapter.Update(xDataTable);
}
 
Share this answer
 
Have a look at INSERT triggers[^].
 
Share this answer
 
v2
You can not create stored procedures by using access database
 
Share this answer
 
Comments
somur-ruteeb 25-Jan-12 7:09am    
procedures on visual studio
ambarishtv 25-Jan-12 7:46am    
Procedures for what ?
hi,

This is a suggestion and might not be the answer.
Cant we use a trigger on that table which fires on insert on that table.
Call the stored procedure in the trigger.

Below is the example

CREATE OR REPLACE my_procedure
(p_variable1 IN my_table.column1%type,
p_variable2 IN my_table.column2%type,
p_out      OUT number)
AS
BEGIN
   p_out := p_variable1 + p_variable2;
END;
/

CREATE OR REPLACE TRIGGER my_test_trigger
BEFORE INSERT ON my_table
DECLARE
   v_out   number;
BEGIN
   my_procedure(:new.column1, :new.column2, v_out);
   :new.column3 := v_out;
END;
/


This example is in oracle.
Iam not sure of this example in MS Access.But there must a way doing this.
Hope this helps.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900