Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

ADO.NET Data Adapter for WSS lists?

  Asked By: Cedric    Date: Jan 19    Category: Sharepoint    Views: 2079

Is there such a thing as an existing ADO.NET Data Adapter for WSS lists? ….some like the SqlDataAdapter but data adapter that reads from a SharePoint list?

We're also looking for a unified data access strategy (e.g. ADO Data Adapters) for portal areas and listings (in addition to WSS lists). Each category of SharePoint Web service operates differently.

what an elegant way of binding the selection values in a Webform drop-down list to the list of values in a column in a SharePoint list?

Share: 

 

4 Answers Found

 
Answer #1    Answered By: Spencer Bradley     Answered On: Jan 19

I researched this sometime back and the only solutions I found
involved lots of client side JavaScript.

 
Answer #2    Answered By: Jay Ruiz     Answered On: Jan 19

One technique I have used to provide sharepoint  list data  in drop down fields on Windows forms applications is to create a link to the list  in an access  database and then use the linked table to access the list data. Not quite as clean to implement but it performs well and gives access to the data using the standard ADO data adapter. The linked table is accessible just like any table in an Access database.

 
Answer #3    Answered By: Graham Ingram     Answered On: Jan 19

I was looking for the person's reply who mentioned using an ICollection pattern to load the data  from the web  service ...can't find it ...but just the same, below is some good sample code/pattern from the .NET docs for a Webform dropdownlist that we'll end up using (the adapation to SharePoint WSs is left to the reader).

The following example demonstrates how to use a DataList control to display a list  of items from a data source.

[Visual Basic, C#] Note The following code sample uses the single-file code model and may not work correctly if copied directly into a code-behind file. This code sample must be copied into an empty text file that has an .aspx extension. For more information on the Web Forms code model, see Web Forms Code Model.
[C#]

<%@ Page Language="C#" AutoEventWireup="True" %>
<%@ Import Namespace="System.Data" %>

<html>
<script runat="server">

ICollection CreateDataSource()
{

// Create sample data for the DataList control.
DataTable dt = new DataTable();
DataRow dr;

// Define the columns of the table.
dt.Columns.Add(new DataColumn("IntegerValue", typeof(Int32)));
dt.Columns.Add(new DataColumn("StringValue", typeof(String)));
dt.Columns.Add(new DataColumn("CurrencyValue", typeof(double)));
dt.Columns.Add(new DataColumn("ImageValue", typeof(String)));

// Populate the table with sample values.
for (int i = 0; i < 9; i++)
{
dr = dt.NewRow();

dr[0] = i;
dr[1] = "Description for item " + i.ToString();
dr[2] = 1.23 * (i + 1);
dr[3] = "Image" + i.ToString() + ".jpg";

dt.Rows.Add(dr);
}

DataView dv = new DataView(dt);
return dv;
}


void Page_Load(Object sender, EventArgs e)
{

// Load sample data only once, when the page is first loaded.
if (!IsPostBack)
{
ItemsList.DataSource = CreateDataSource();
ItemsList.DataBind();
}

}

</script>

<body>

<form runat=server>

<h3>DataList Example</h3>

<asp:DataList id="ItemsList"
BorderColor="black"
CellPadding="5"
CellSpacing="5"
RepeatDirection="Vertical"
RepeatLayout="Table"
RepeatColumns="3"
ShowBorder="True"
runat="server">

<HeaderStyle BackColor="#aaaadd">
</HeaderStyle>

<AlternatingItemStyle BackColor="Gainsboro">
</AlternatingItemStyle>

<HeaderTemplate>

List of items

</HeaderTemplate>

<ItemTemplate>

Description:
<%# DataBinder.Eval(Container.DataItem, "StringValue") %>



Price: <%# DataBinder.Eval(Container.DataItem, "CurrencyValue", "{0:c}") %>



<asp:Image id="ProductImage"
ImageUrl='<%# DataBinder.Eval(Container.DataItem, "ImageValue") %>'
runat="server"/>

</ItemTemplate>

</asp:DataList>

</form>

</body>
</html>

 
Answer #4    Answered By: Francisco Simpson     Answered On: Jan 19

I believe I heard that ASP.NET 2.0 and VS.NET 2005 will have built-in
Data Adapters for WSS Lists.

 
Didn't find what you were looking for? Find more on ADO.NET Data Adapter for WSS lists? Or get search suggestion and latest updates.




Tagged: