February 3, 2012 at 6:18 am
To answer your question John - it works fine in VB. But ideally I wanted to turn the code to a Stored Procedure.
February 3, 2012 at 6:39 am
OK, so you need to turn it into a stored procedure. You need to use dynamic SQL to build the query, a bit like you were doing in the thread I helped you with earlier this week. (Yes, I tried to persuade you not to use dynamic SQL, but here it's probably the right thing to do.) Instead of using VB to build your query string, you use T-SQL. The link I posted in that other thread should have enough examples to get you started.
Good luck
John
February 3, 2012 at 6:51 am
Use the SQL Server profile (in the SSMS 2008 -> tools)
It can capture any command sent to the server (you ill need to learn how to use it, but that's no hard)
Put the profiler to run just before running your code (use a breakpoint in your VS).
Caught whatever the application is sending to the server and post it here.
And tell your boss old developer to stop to use dynamic SQL!
PS: I'm a old boss developer.
February 3, 2012 at 7:07 am
Sorry JCB - do you have time to do a quick run through of how I link SQL Server profiler to visual studio 2010?
February 3, 2012 at 7:10 am
You don't. You link it to SQL Server at the same time that the web page is running. That way you can capture the SQL that is being executed on SQL Server. What it won't do is tell you how to build the SQL statement that is being executed.
John
February 3, 2012 at 7:17 am
What do I put in the events section?
February 3, 2012 at 7:21 am
I only want to run the profiler for a section of the VB code - is that possible?
February 3, 2012 at 7:24 am
Profiler will capture (the whole of) every statement executed on the server, subject to any filter placed on the trace.
February 3, 2012 at 7:26 am
I still don't know what to put in the events section - how embarrasing! 🙁
February 3, 2012 at 8:20 am
Try creating CLR stored procedure in .Net and then execute it through SSMS......
February 3, 2012 at 8:34 am
In your case it ill (presumably) fall in the TSQL:SQL batch completed, but its (probably) marked as default.
If you are conding in visual studio, just put a break point before the execute command.
put the profile to run, it ill capture commands sent to the server.
hit F10 in the vs to execute the command.
go to profile and see what it caught, then you can stop profile or its ill continuous capture anything.
Viewing 11 posts - 16 through 25 (of 25 total)
You must be logged in to reply to this topic. Login to reply