Last post Nov 13, 2013 03:00 AM by smilu.net
Mar 07, 2006 05:52 PM|asdpai|LINK
How to test @au_lname's value sends to the following following sql command?
As New SqlCommand("UPDATE [authors] SET [au_lname] = @au_lname", MyConnection)MyCommand.Parameters.Add(New
SqlParameter("@au_lname", SqlDbType.NVarChar)).Value = me.au_lname.text
I tried to print the "MyCommand.CommandText.ToString" but only get
UPDATE [authors] SET [au_lname] = @au_lname with no value in the command text.
Mar 07, 2006 06:40 PM|douglas.reilly|LINK
Mar 07, 2006 06:55 PM|Connect|LINK
Unfortunately Profiler only comes with full version of Sql Server...
You can also debug stored procedures using Visual Studio - see [url=http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsdebug/html/vxtskdebuggingsqlstoredprocedures.asp]this MSDN article[/url].
Mar 08, 2006 09:44 AM|bitmask|LINK
1. Put the cursor on the line of code with the new SqlParameter. Drop a breakpoint on the line by pressing F9 (Debug -> Toggle Breakpoint).
2. Start the debugger running with F5 (Debug -> Start Debugging).
3. When the debugger breaks on your line of code that creates the parameter, press F10 to step to the next line (Debug -> Step Over).
4. Open a Watch window with Ctrl+Alt+W (or Debug -> Windows -> Watch from the menu).
5. In the watch window type in MyCommand. You can click through the object and drill into the parameters. You could also enter MyCommand.Parameters(0).Value to go straight to the value you want to see.
I have some other debugging tips in an article:
Basic Debugging Features In Visual Studio 2005. Most of this also applies to 2003.
Mar 08, 2006 10:14 AM|douglas.reilly|LINK
The original question does not specify SQL Server version or edition, however, as a developer, I would find a way to spring for the developer's edition, which used to be about US$45 for SQL 2000, and is worth every penny.
That said, generally placing a breakpoint on the line where the parameter is set will help you figure out what is really being sent...
Nov 13, 2013 03:00 AM|smilu.net|LINK
This one is good. i was not knowign this.