0

hi all, i m new to sharepoint pls help - Any idea about the Sharepoint Databse structure ? I am using SqlServer 2005 with .NET, Sharepoint How to access my database? where is connection file in sharepoint ?

4
Contributors
9
Replies
11
Views
7 Years
Discussion Span
Last Post by gptArun
0

>Any idea about the Sharepoint Databse structure ?

Read - http://en.wikipedia.org/wiki/Microsoft_SharePoint

> I am using SqlServer 2005 with .NET, Sharepoint How to access my database?

Read - ADO.NET

>where is connection file in sharepoint ?

Read - ADO.NET

If you need to change any of the databases for SharePoint you should do it from the Central Administration Website.
With that being said, the connectionString information is stored in the registry of your SharePoint IIS Server.
HKLM\Software\Microsoft\Shared Tools\Web Server Extensions\12.0\Secure

Edited by dsweb1017: spelling correction

0

Thanks for your reply, But i didn't found Secure folder in 12 hives folder. there is another way?

Using OS - Server 2003, VS2005, SqlServer2005, Sharepoint Designer 2007

0

Thanks "AdataPost" for your reply , any more helpful urls regarding Sharepoint, .NEt, SQLSERVER ?

0

Hello there gptArun,
The Hive is there, take a look again:) One thing I forgot to tell you is that this DSN key, once you find it, displays the Configuration database only.
Do a search from the Registry and enter "ConfigDB"

My Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0\Secure\ConfigDB

Regards,
dsweb1017

Edited by dsweb1017: n/a

0

Thanks dsweb1017;
I got ConfigDB [My Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0\Secure\ConfigDB
] in registry, tried in Microsoft Sharepoint Designer 2007 to connect with query string but not connected.

0

Any working example for create Webpart in VS2005 and deploy in Sharepoint ?

0

Any working example for create Webpart in VS2005 and deploy in Sharepoint ?

This is a simple web part that I built to read the lists on the current web, enumerate them in a list box and then switch between the lists when you change them. It shows the default view of the list. It should give you the basic structure of how to build a web part:

using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

using Microsoft.SharePoint;
using wpp = Microsoft.SharePoint.WebPartPages;
using Microsoft.SharePoint.WebControls;

namespace Portal.Contacts {
    public class ContactViewer : wpp.WebPart {
        protected Label lblSelectContactsList;
        protected DropDownList ddlContactLists;
        protected Table tblContacts;
        protected Panel pnlContacts;

        private string _ListID = "0";

        [Personalizable(true), WebBrowsable(false)]
        public string ListID { get { return _ListID; } set { _ListID = value; } }

        protected override void CreateChildControls() {
            this.Controls.Clear();
            
            base.CreateChildControls();

            tblContacts = new Table();
            TableRow trSelect = new TableRow();
            TableCell tdSelectHeader = new TableCell();
            tdSelectHeader.Width = Unit.Percentage(20.0);
            tdSelectHeader.Wrap = false;
            lblSelectContactsList = new Label(); 
            lblSelectContactsList.CssClass = "ms-vb";
            lblSelectContactsList.Text = "Select a Contact List to view:";
            tdSelectHeader.Controls.Add(lblSelectContactsList);

            TableCell tdSelectList = new TableCell();
            tdSelectList.Width = Unit.Percentage(80.0);
            ddlContactLists = new DropDownList();
            LoadContactListsDDL();
            ddlContactLists.CssClass = "ms-input";
            ddlContactLists.AutoPostBack = true;
            ddlContactLists.SelectedIndexChanged += new EventHandler(ddlContactLists_SelectedIndexChanged);
            tdSelectList.Controls.Add(ddlContactLists);

            trSelect.Cells.Add(tdSelectHeader);
            trSelect.Cells.Add(tdSelectList);

            TableRow trContactsView = new TableRow();
            TableCell tdContactsView = new TableCell();
            tdContactsView.ColumnSpan = 2;
            pnlContacts = new Panel();
            if (!this.Page.IsPostBack) {
                LoadContactsView();
            }
            tdContactsView.Controls.Add(pnlContacts);
            
            trContactsView.Cells.Add(tdContactsView);
            
            tblContacts.Rows.Add(trSelect);
            tblContacts.Rows.Add(trContactsView);

            this.Controls.Add(tblContacts);
        }

        void ddlContactLists_SelectedIndexChanged(object sender, EventArgs e) {
            this.ListID = ddlContactLists.SelectedValue;
            this.SetPersonalizationDirty();
            this.SaveProperties = true;
            this.SaveControlState();
            
            LoadContactsView();
        }

        protected void LoadContactListsDDL() {
            Guid webid = SPContext.Current.Web.ID;
            Guid siteid = SPContext.Current.Site.ID;

            ddlContactLists.Items.Add(new ListItem("-- Select --", "0"));

            using (SPSite site = new SPSite(siteid)) {
                using (SPWeb web = site.AllWebs[webid]) {
                    foreach (SPList list in web.Lists) {
                        if (list.BaseTemplate == SPListTemplateType.Contacts) {
                            ddlContactLists.Items.Add(new ListItem(list.Title, list.ID.ToString()));
                            if (list.ID.ToString() == this.ListID) {
                                ListItem liSelected = ddlContactLists.Items.FindByValue(this.ListID);
                            }
                        }
                    }
                }
            }
        }
        protected void LoadContactsView() {
            LiteralControl lcContactsView = new LiteralControl();
            lcContactsView.Text = "";

            if (this.ListID != "0") {
                Guid webid = SPContext.Current.Web.ID;
                Guid siteid = SPContext.Current.Site.ID;
                Guid listid = new Guid(this.ListID);

                using (SPSite site = new SPSite(siteid)) {
                    using (SPWeb web = site.AllWebs[webid]) {
                        SPList list = web.Lists[listid];
                        SPQuery query = new SPQuery(list.DefaultView);
                        lcContactsView.Text = list.RenderAsHtml(query);
                    }
                }
            } else {
                lcContactsView = new LiteralControl("<span class=\"ms-vb\">You need to select a contacts list above to view the contacts.</span>");
            }

            pnlContacts.Controls.Add(lcContactsView);

        }
    }
}

for deploying the web part to SharePoint, I highly recommend the following CodePlex solutions:

WSPBuilder - Package the solution for SharePoint Deployment (integrates with VS2005 or 2008 menus)
http://wspbuilder.codeplex.com/

SharePoint Solution Installer - Nice GUI for Deploying (make sys-ad's happy)
http://sharepointinstaller.codeplex.com/

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.