Dan Mc

Dan Mc

  • NA
  • 1
  • 0

Display SQL statement on aspx page for debugging with ado.net

Oct 10 2007 12:04 PM
Hello.
I have a sql statement which are using variables from form Data. I would like to output the sql query on the webpage for debugging.

objCmd = new SqlCommand("SELECT DISTINCT PROV_SPECIALTIES.LAST_NAME,  PROV_SPECIALTIES.PHYS_STATE, PROV_SPECIALTIES.ZIP, PROV_SPECIALTIES_FINAL.SPECIALTIES,  LEFT OUTER JOIN PROV_SPECIALTIES_FINAL ON PROV_SPECIALTIES.PROV_ID = PROV_SPECIALTIES_FINAL.PROV_ID WHERE (PROV_SPECIALTIES.ZIP LIKE '%' + @ZIP + '%') AND (PROV_SPECIALTIES.PHYS_STATE = @State) AND (PROV_SPECIALTIES.SPECIALTY IN (@SPECIALTYSELECTED))", objConn);
           
 objCmd.Parameters.Add("@ZIP" , txtSearch.Text);
 objCmd.Parameters.Add("@STATE", ddlState.SelectedItem.Value);
 objCmd.Parameters.Add("@SPECIALTYSELECTED", lbSpecialty.SelectedItem.Value);

I would like to do something like Response.Write(objCmd)
My hangup is I want to see if @SPECIALTYSELECTED are pulling the values from the listbox control and using them in the SQL statement.

Thanks.

Answers (1)