asp.net : c# : sql

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vishalgupta
    New Member
    • Jun 2007
    • 47

    #1

    asp.net : c# : sql

    can i by any means display the sql query executed in the asp .net using Response.Write( ) [except for the Response.Write( "select * from t1;")];]
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Originally posted by vishalgupta
    can i by any means display the sql query executed in the asp .net using Response.Write( ) [except for the Response.Write( "select * from t1;")];]
    I would advise against using Response.Write because it writes to the Output Stream sent to the browser. This could result in undesired results. For example the output could be written outside of your <html> tags using Response.Write making your webpage invalid.

    Use a Label, Localize, Textbox or some other control to display your output.

    I'm not sure what you are trying to do.
    Could you please explain your problem in more detail.

    Thanks
    -Frinny

    Comment

    • nateraaaa
      Recognized Expert Contributor
      • May 2007
      • 664

      #3
      Originally posted by vishalgupta
      can i by any means display the sql query executed in the asp .net using Response.Write( ) [except for the Response.Write( "select * from t1;")];]
      It depends. If your sql query returns a single value Response.Write will work just fine. However, if your sql query contains tabular data you will need to create a datatable or dataset and loop through the rows/columns of the table to output the data using Response.Write( ). It would be much easier to create a datagrid and output the data that way instead of using Response.Write.

      Nathan

      Comment

      Working...