I am using the following situation:
cmd.CommandText = "insert into city (id, code, name, uf) values ??(@ id, @ code, @ name, @ uf);"
I wonder what would bring me in command after the format string supplied to the parameters
situation:
insert into city (id, code, name, uf) values ??(5, 5, 'BIG COUNTRY', 'MS'); – for example
After the parameters have fed as I get this “string” already fed and move to a string??
My idea is to create a log, so need to get the parameters already filled in to generate a system log!
If you’re using SQL Server, have you considered using SQL Server Profiler instead? If you’re not using SQL Server, other RBDMS systems should have similar tools…
It would probably be less effort than adding this type of logging into your application, and it would also guarantee that you’re seeing what is actually sent to your database, and that your logging code hasn’t accidentally misinterpreted and incorrectly logged the query.
If you have an aversion to profiling, which would be justified if we’re talking about a production database that won’t be able to handle the overhead of profiling, you could assemble your log with something similar to the following: