I have displayed some SQL data in MOSS 2007 with the help of Data View web part. However I wish to create a template sort of from this web part so that going forward I can just go ahead and change the connection string of sql server and the sql query to fetch data and I am done. Any ideas for doing this. If not possible, is there any out-of-box web part to get this functionality? Thanks in advance.

  • Configure the webpart
  • Export it to a .webpart file:

enter image description here

  • Navigate to Site settings, and select "Webparts gallery" under Galleries category
  • Upload previously saved file to the gallery:

enter image description here

  • Specify it's name and other settings, if needed
  • Navigate to a site page, switch to page edit mode, and there you will be able to add your webpart (by default, it will be under Miscellaneous category)
  • Did the same steps. But where can I configure the SQL connection and SQL query? – Ashish Oct 17 '11 at 6:29
  • In SPD, by connecting appropriate DataSource to the webpart. If you want to do this from GUI by setting connection string and query through webpart properties, you will have to implement your own webpart, probably derived from DVWP, with additional property and it will have to create it's DataSource automatically. But I'm afraid that will cost much more labour hours, and actually I can't realize, why you would prefer this hard way, while SPD already has almost what you need (just create the datasource through SPD GUI and you're done) – Andrey Markeev Oct 17 '11 at 7:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.