Click here to Skip to main content
15,901,283 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am using MySql database and want to update data; parallel to record each and every query. For achieving this I need to track Sql commands those are prepared by C# program. I tried to get Sql Command by using below code; but it is not working.

Thanks & Regards
Thahir

C#
private void UpdateData()
{
preUpdate();
DataTable changes = data.GetChanges();
if (changes != null)
{
MessageBox.Show(da.UpdateCommand.CommandText);
da.Update(changes);
data.AcceptChanges();
}
}
Posted
Updated 23-Jun-12 5:23am
v4
Comments
Sandeep Mewara 23-Jun-12 10:31am    
Your question is still not clear.

1 solution

exactly what do you want??? I think you want to view your query before executing??? If I am right use debugger and use
SQL profiler
.. for previewing your query..

Thanks
 
Share this answer
 
Comments
Sandeep Mewara 23-Jun-12 10:28am    
Comment from OP:
I would like to track and record all my Insert, Update & Delete command from my C# application

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