473,386 Members | 1,804 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Find all SqlCommands added to form

Hi,

I am writing some debugging code for my company's web based C# system.
I am trapping errors and send emails to the dev team. What I would like
to do is to find each SqlCommand that is 'on' the particular page and
cycle through its params and get the values for each.

So if I have a handle on the page (I can cycle through the controls)
how do I get to the SqlCommands?

Tim

Jun 19 '06 #1
4 1093
Hi,

You cannot , SqlCommands are not part of the Controls collection.

IMO your algorithm is not correct, you can create a SqlCommand inside a
method and get an exception from it. This instance is not a member of the
page.
Can you modify the code?
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Nawoct" <na****@gmail.com> wrote in message
news:11**********************@f6g2000cwb.googlegro ups.com...
Hi,

I am writing some debugging code for my company's web based C# system.
I am trapping errors and send emails to the dev team. What I would like
to do is to find each SqlCommand that is 'on' the particular page and
cycle through its params and get the values for each.

So if I have a handle on the page (I can cycle through the controls)
how do I get to the SqlCommands?

Tim

Jun 19 '06 #2
A better solution here would be to run a trace on the SQL Server that
the page is making calls to, and figuring out the values of the parameters
from that.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:u%******************@TK2MSFTNGP05.phx.gbl...
Hi,

You cannot , SqlCommands are not part of the Controls collection.

IMO your algorithm is not correct, you can create a SqlCommand inside a
method and get an exception from it. This instance is not a member of the
page.
Can you modify the code?
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Nawoct" <na****@gmail.com> wrote in message
news:11**********************@f6g2000cwb.googlegro ups.com...
Hi,

I am writing some debugging code for my company's web based C# system.
I am trapping errors and send emails to the dev team. What I would like
to do is to find each SqlCommand that is 'on' the particular page and
cycle through its params and get the values for each.

So if I have a handle on the page (I can cycle through the controls)
how do I get to the SqlCommands?

Tim


Jun 19 '06 #3
Thanks Ignacio,

The SqlCommands are already inside methods in each page. We have some
code which is core to every page. It has a handle to every page as it
loads and I wanted to try and make the change once there, as opposed to
adding code to every page that needs it.

Tim

Ignacio Machin ( .NET/ C# MVP ) wrote:
Hi,

You cannot , SqlCommands are not part of the Controls collection.

IMO your algorithm is not correct, you can create a SqlCommand inside a
method and get an exception from it. This instance is not a member of the
page.
Can you modify the code?
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Nawoct" <na****@gmail.com> wrote in message
news:11**********************@f6g2000cwb.googlegro ups.com...
Hi,

I am writing some debugging code for my company's web based C# system.
I am trapping errors and send emails to the dev team. What I would like
to do is to find each SqlCommand that is 'on' the particular page and
cycle through its params and get the values for each.

So if I have a handle on the page (I can cycle through the controls)
how do I get to the SqlCommands?

Tim


Jun 19 '06 #4
Hi,

As I said if the SqlCommand is declared inside the method you cannot access
it , at least I do not know a method for doing it, you would have to modify
the code.
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Nawoct" <na****@gmail.com> wrote in message
news:11**********************@r2g2000cwb.googlegro ups.com...
Thanks Ignacio,

The SqlCommands are already inside methods in each page. We have some
code which is core to every page. It has a handle to every page as it
loads and I wanted to try and make the change once there, as opposed to
adding code to every page that needs it.

Tim

Ignacio Machin ( .NET/ C# MVP ) wrote:
Hi,

You cannot , SqlCommands are not part of the Controls collection.

IMO your algorithm is not correct, you can create a SqlCommand inside a
method and get an exception from it. This instance is not a member of the
page.
Can you modify the code?
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Nawoct" <na****@gmail.com> wrote in message
news:11**********************@f6g2000cwb.googlegro ups.com...
> Hi,
>
> I am writing some debugging code for my company's web based C# system.
> I am trapping errors and send emails to the dev team. What I would like
> to do is to find each SqlCommand that is 'on' the particular page and
> cycle through its params and get the values for each.
>
> So if I have a handle on the page (I can cycle through the controls)
> how do I get to the SqlCommands?
>
> Tim
>

Jun 19 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Edward | last post by:
hi, everyone, my Page_Load fill tblProducts with some TextBox. <form runat="server"> <asp:Table id="tblProducts" runat="server"></asp:Table> <hr> <asp:Button id="Button1"...
2
by: Michael | last post by:
Need some help trying to read values from web controls - specifically *finding* the controls (like a drop down list) - that are added dynamically added within an asp:panel control. The page...
4
by: Martin Hill | last post by:
Hi there, How can I find the components added to web form from my custom web control? Suppose I added a Timer component (with name "timer1") onto the web form, from my user web control, how...
5
by: Mike Labosh | last post by:
In VB 6, the Form_QueryUnload event had an UnloadMode parameter that let me find out *why* a form is unloading, and then conditionally cancel the event. In VB.NET, the Closing event passes a...
1
by: Jason Huang | last post by:
Hi, In C# Windows Form, how to build several SqlCommands on one SqlConnection? Would someone show me an exzmple? Thanks for help. Jason
0
by: Max | last post by:
If you don't want to read the drivel in my main message body here is the question at the end. How do you find a string in a column and make the BindingNavigator Navigate to the correct row?? ...
4
by: Kaur | last post by:
I am reposting this message. I am a beginner using MS Access. I am working in MS Access 2000 and have created two forms. Form 1 is called frmParent (which has a read only subform called SfrmChild)....
2
by: Chris | last post by:
I have a user control which is dynamically loaded into a placeholder. I have a formview in the user control In the page load event of the user control I wand to find a dropdown in the formview....
5
by: YaoBao | last post by:
Is any ColdFusion script I can put on my webpage that will create a search bar so people can type keywords to match it on the current page in my website? It will be exactly like the finder search bar...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.