HttpContext.Current.User.Identity.Name
Monday, 25 March 2013
use of People Picker programmatically in web-parts and pages
Add
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
in the page.
<SharePoint:PeopleEditor ID="spPeoplePickerUserName" Width="200" runat="server" SelectionSet="User" AllowEmpty="true" MultiSelect="false" AutoPostBack="false" />
to store the data use
if (spPeoplePickerRespUser.ResolvedEntities.Count > 0)
{
PickerEntity selectedEntity = (PickerEntity)spPeoplePickerRespUser.ResolvedEntities[0];
SPUser user = oWeb.EnsureUser(selectedEntity.Key);
itemToAdd["Entered_x0020_By"] = user;
}
for edit mode,
spPeoplePickerUserName.CommaSeparatedAccounts = Convert.ToString(itemToUpdate["User_x0020_Name"]);
if (spPeoplePickerUserName.ResolvedEntities.Count > 0)
{
PickerEntity entity = (PickerEntity)spPeoplePickerUserName.ResolvedEntities[0];
accountName = entity.Key;
int pos = accountName.IndexOf('\\');
accountName = accountName.Substring(pos + 1);
SetContactInformation(accountName);
}
How to get the second people picker in a page through javascript and to populate the current username
var tags = document.getElementsByTagName('DIV');
var count = 0;
for(var i=0;i<tags.length;i++)
{
if(tags[i].title == 'People Picker')
{
count = count +1;
if(count == 2)
{
SetTheCurrentUser1(tags[i].id);
}
}
}
function SetTheCurrentUser1(ctrlPeoplePicker)
{
var currentUser = "";
currentUser = $().SPServices.SPGetCurrentUser({
fieldName: "Name"
});
// alert(currentUser);
if(currentUser != "")
{
svSetPeoplePickerValue(ctrlPeoplePicker,currentUser);
}
}
function svSetPeoplePickerValue(strControlId, strValue)
{
var ctlUpLevel = document.getElementById(strControlId);
// Get the portion of the ID preceeding '_upLevelDiv'
// all controls' ids for the people picker start with this
var subs = ctlUpLevel.id.substring(0, ctlUpLevel.id.indexOf("_upLevelDiv"));
// Magically set the value of the People Picker (and associated fields)
var ctlDownLevel = document.getElementById(getSubControlID(subs, g_EntityEditorDownLevelId));
ctlDownLevel.value = strValue;
SetInnerText(ctlUpLevel, strValue);
copyUplevelToHidden(subs);
}
// The functions getSubControlID, SetInnerText, copyUplevelToHidden and
// the variable g_EntityEditorDownLevelId are provided by SharePoint.
this form was customized not working with attachment sharepoint 2007
Source--http://support.microsoft.com/kb/953271
- For custom edit item forms and for custom new item forms
- In the XSL code block, locate the following code.
<xsl:template name="dvt_1"> <xsl:variable name="dvt_StyleName">ListForm</xsl:variable> <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row"/> <table border="0" width="100%"> <xsl:call-template name="dvt_1.body"> <xsl:with-param name="Rows" select="$Rows"/> </xsl:call-template> </table> </xsl:template> - Replace the lines of code that you located in step 2a with the following lines of code.Note The XSLT code must have the ControlMode set to "New" for custom new item forms and to "Edit" for custom edit item forms.
<xsl:template name="dvt_1"> <xsl:variable name="dvt_StyleName">ListForm</xsl:variable> <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row"/> <div> <span id="part1"> <table border="0" width="100%"> <xsl:call-template name="dvt_1.body"> <xsl:with-param name="Rows" select="$Rows"/> </xsl:call-template> </table> </span> <SharePoint:AttachmentUpload runat="server" ControlMode="Edit"/> <SharePoint:ItemHiddenVersion runat="server" ControlMode="Edit"/> </div> </xsl:template> - Locate the following line of code.
<xsl:if test="$dvt_1_automode = '1'" ddwrt:cf_ignore="1">
- Paste the following code above the line of code that you located in step 2c.Note This code sample is for a custom edit item form. If you use a custom new item form, replace ControlMode=”Edit” with ControlMode=”New” in the code.
<tr id="idAttachmentsRow"> <td nowrap="true" valign="top" class="ms-formlabel" width="20%"> <SharePoint:FieldLabel ControlMode="Edit" FieldName="Attachments" runat="server"/> </td> <td valign="top" class="ms-formbody" width="80%"> <SharePoint:FormField runat="server" id="AttachmentsField" ControlMode="Edit" FieldName="Attachments" __designer:bind="{ddwrt:DataBind('u','AttachmentsField','Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Attachments')}"/> <script> var elm = document.getElementById("idAttachmentsTable"); if (elm == null || elm.rows.length == 0) document.getElementById("idAttachmentsRow").style.display='none'; </script> </td> </tr>
Additionally, in the __designer:bind attribute, the first parameter for the ddwrtDataBind function should be "'i'" (insert) for a custom new item form and "'u'" (update) for a custom edit item form.
For example, the code may resemble the following code.<SharePoint:FormField runat="server" id="AttachmentsField{$Pos}" ControlMode="New" FieldName="Attachments" __designer:bind="{ddwrt:DataBind('i',concat('AttachmentsField',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Attachments')}"/> - Save the form.
- Open the Custom List form.
- Move the cursor to the table cell in the custom form control where you want the attachment to be displayed. Then, right-click the cell, point to Insert, and then click Row Below. A new table row that has two column cells is created.
- Move the cursor to the left table cell of the new row, and then type Attachments.
- Move the cursor to the right-side table cell of the new row, switch to Code view, and then enter the following code.
<SharePoint:AttachmentsField ControlMode="Display" FieldName="Attachments" runat="server" Visible="true"/>
- Save the form.
- In the XSL code block, locate the following code.
- If you make more changes to the page, SharePoint Designer 2007 may automatically add a unique ID to the attachment code that you added. For example, “<tr id="idAttachmentsRow">” is changed to “<tr id="idAttachmentsRow{generate-id}">.”
This process may cause JavaScript errors on the page. If this issue occurs, delete the “{generate-id}” tags that are added automatically. - You may receive the following error message:To resolve this issue, move the Custom List form outside the Web Part zone.An unexpected error has occurred
- You receive the following a JavaScript error message:If you receive this error message, make sure that the ListForm Web Part that is on the page by default is still there. Then, set the Layout to Hidden, and close the Web Part. To do this, follow these steps:Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus.
- Right-click the List form Web Part in SharePoint Designer.
- Click Web Part Properties, and then click Layout.
- In the Layout dialog box, click to select Hidden, and then close the Web Part.
Error while updating look up columns programmatically in SharePoint
error- Invalid data has been used to update the list item. The field you are trying to update may be read only.
Resolution :--
SPFieldLookupValue value = new SPFieldLookupValue(Convert.ToInt32(ddlTest.SelectedValue), ddlTest.SelectedItem.Text);
itemToAdd["ColumnName"] = value;
Resolution :--
SPFieldLookupValue value = new SPFieldLookupValue(Convert.ToInt32(ddlTest.SelectedValue), ddlTest.SelectedItem.Text);
itemToAdd["ColumnName"] = value;
Where ddlTest is a dropdown and dropdown value contains the id of the column and dropdown text contains the text of the column of the parent list.
Redirect page using xslt in sharepoint list pages
You can achieve this using the second solution which you have said.
What you need do is give the url value to the GenFireServerEvent method.
Before:
{ddwrt:GenFireServerEvent('__commit;__redirect={/}')};
After:
{ddwrt:GenFireServerEvent('__commit;__redirect={http://www.microsoft.com}')};
Note: If you change like his, you will receive a
warning message like this: “You are about to be redirected to a new internet site.” Of course, if the target url is in the same site with the page, you will not receive the warning message.
Hope it’s helpful.
Thursday, 21 February 2013
Sharepoint 2010 Migration.
Sharepoint 2010 Upgrade requirements:
Before you can perform an in-place upgrade or database attach upgrade to SharePoint Server 2010, your existing Office SharePoint Server 2007 environment or new SharePoint Server 2010 environment must meet the following minimum requirements.
NOTE: For Sharepoint HOT Jobs jobmust
1.Hardware requirements:
SharePoint Server 2010 can only run on a 64-bit edition of the
Windows Server 2008 R2 or Windows Server 2008 with SP2 O/S.
If you plan an in-place upgrade, your Office SharePoint Server 2007 installation must be running in a 64-bit Windows Server 2008 environment.
If your Office SharePoint Server 2007 installation is currently in a 32-bit environment, you cannot perform an in-place upgrade on the existing server or server farm.
You must install SharePoint Server 2010 on a different server or farm that supports 64-bit applications, and then move your data to that server or farm by using database attach upgrade.
2.Operating system requirement:
Windows Server 2008 or Windows Server 2008 R2:
SharePoint Server 2010 must be run on a 64-bit edition of Windows Server 2008 R2 or Windows Server 2008 with Service Pack 2 (SP2). If you are currently running Office SharePoint Server 2007 on Windows Server 2003 and intend to upgrade to SharePoint Server 2010, you must plan to have a sufficient number of Windows Server licenses for the deployment on the newer operating system.
To more easily discover and address any issues in the migration and upgrade processes, we recommend that you do not combine the actions of upgrading or migrating to Windows Server 2008 or Windows Server 2008 R2 with the process of upgrading to SharePoint Server 2010. You can combine migration to 64-bit hardware with migration to Windows Server 2008 or Windows Server 2008 R2.
3.Pre-upgrade checker
The pre-upgrade checker is a command-line tool that you run in a Office SharePoint Server 2007 environment to find any potential issues for upgrade and to review recommendations and best practices.
STSADM.exe –o preupgradecheck
By using the pre-upgrade checker, you can find information such as the following:
A list of all servers and components in the farm, and whether the servers meet the following requirements for upgrading: 64-bit hardware and the Windows Server 2008 operating system.
The alternate access mapping URLs that are being used in the farm.
1)A list of all site definitions, site templates, features, and language packs that are installed in the farm.
2)Whether there are customizations in the farm that are not supported (such as database schema modifications).
3)Whether there are any database or site orphans in the farm.
4)Whether there are missing or invalid configuration settings in the farm (such as a missing Web.config file, invalid host names, or invalid service accounts).
5)Whether the databases meet the requirements for upgrade — for example, databases are set to read/write, and any databases and site collections that are stored in Windows Internal Database are not larger than 4 GB.
4.Windows PowerShell command to check databases before attaching
You can use the Windows PowerShell cmdlet test-spcontentdatabase before you attach a content database to SharePoint Server 2010 to determine whether any server-side customizations are missing from the environment.
Test-SPContentDatabase [-Identity][-AssignmentCollection ] [-DatabaseCredentials ] [-ServerInstance ] [-ShowRowCounts ]
Test-SPContentDatabase -Name-WebApplication [-AssignmentCollection ] [-DatabaseCredentials ] [-ServerInstance ] [-ShowRowCounts ]
EX:Test-SPContentDatabase -name WSS_Content_DB -webapplication http://sitename
Set the previous version databases to be read-only (database attach with read-only databases)
If you are using the read-only databases hybrid approach to upgrade, set the previous version databases to read-only before you back up the databases. In any type of database attach upgrade, you can also set the databases to read-only temporarily to ensure that you capture all the data in the backup so that you are restoring and upgrading the current state of the environment. If the databases are set to read-only, users can continue to view content, but they will be unable to add or change content.
To set a database to read-only in SQL Server 2000
In SQL Server Enterprise Manager, right-click the name of the database that you want to set to read-only, and then click Properties.
1.In the Properties dialog box, click the Options tab.
2.Under Access, select the Read-only check box, and then click OK.
To set a database to read-only in SQL Server 2005
1.In SQL Server Management Studio, right-click the name of the database that you want to set to read-only, and then click Properties.
2.In the Select a page section, click Options.
3.In the right pane, under Other options, in the State section, next to Database Read-Only, click the arrow, and then select True.
To set a database to read-only in SQL Server 2008
1.In SQL Server Management Studio, in Object Explorer, connect to an instance of the Database Engine, expand the server, and then expand Databases.
2.Select the database that you want to configure to be read-only, right-click the database, and then click Properties.
3.In the Database Properties dialog box, in the Select a page section, click Options.
4.In the right pane, under Other options, in the State section, next to Database Read-Only, click the arrow, and then select True.
Visual Upgrade
A new feature that is available with upgrade allows the server administrator or site owner to determine when and if the new look for SharePoint Server 2010 is used for a particular site collection. Server administrators can choose to adopt the new look and feel for all sites during upgrade, let site owners make the choice after upgrade, or keep the old look and feel for all sites.
If the server administrator lets the site owners decide, after a site is upgraded by using an in-place upgrade, a preview option is available in the site user interface. This option provides a preview of the SharePoint Server 2010 look for the site:
If the owner likes how the site looks and functions, the owner can accept the visual upgrade.
If the owner wants the site to keep the old look and feel, the owner can revert to the Office SharePoint Server 2007 look.
By default, the Office SharePoint Server 2007 look is retained. For more information, see Plan visual upgrade (SharePoint Server 2010).
collected from http://rahulbach.blogspot.in/2010/06/sharepoint-2010-migration.html
Before you can perform an in-place upgrade or database attach upgrade to SharePoint Server 2010, your existing Office SharePoint Server 2007 environment or new SharePoint Server 2010 environment must meet the following minimum requirements.
NOTE: For Sharepoint HOT Jobs jobmust
1.Hardware requirements:
SharePoint Server 2010 can only run on a 64-bit edition of the
Windows Server 2008 R2 or Windows Server 2008 with SP2 O/S.
If you plan an in-place upgrade, your Office SharePoint Server 2007 installation must be running in a 64-bit Windows Server 2008 environment.
If your Office SharePoint Server 2007 installation is currently in a 32-bit environment, you cannot perform an in-place upgrade on the existing server or server farm.
You must install SharePoint Server 2010 on a different server or farm that supports 64-bit applications, and then move your data to that server or farm by using database attach upgrade.
2.Operating system requirement:
Windows Server 2008 or Windows Server 2008 R2:
SharePoint Server 2010 must be run on a 64-bit edition of Windows Server 2008 R2 or Windows Server 2008 with Service Pack 2 (SP2). If you are currently running Office SharePoint Server 2007 on Windows Server 2003 and intend to upgrade to SharePoint Server 2010, you must plan to have a sufficient number of Windows Server licenses for the deployment on the newer operating system.
To more easily discover and address any issues in the migration and upgrade processes, we recommend that you do not combine the actions of upgrading or migrating to Windows Server 2008 or Windows Server 2008 R2 with the process of upgrading to SharePoint Server 2010. You can combine migration to 64-bit hardware with migration to Windows Server 2008 or Windows Server 2008 R2.
3.Pre-upgrade checker
The pre-upgrade checker is a command-line tool that you run in a Office SharePoint Server 2007 environment to find any potential issues for upgrade and to review recommendations and best practices.
STSADM.exe –o preupgradecheck
By using the pre-upgrade checker, you can find information such as the following:
A list of all servers and components in the farm, and whether the servers meet the following requirements for upgrading: 64-bit hardware and the Windows Server 2008 operating system.
The alternate access mapping URLs that are being used in the farm.
1)A list of all site definitions, site templates, features, and language packs that are installed in the farm.
2)Whether there are customizations in the farm that are not supported (such as database schema modifications).
3)Whether there are any database or site orphans in the farm.
4)Whether there are missing or invalid configuration settings in the farm (such as a missing Web.config file, invalid host names, or invalid service accounts).
5)Whether the databases meet the requirements for upgrade — for example, databases are set to read/write, and any databases and site collections that are stored in Windows Internal Database are not larger than 4 GB.
4.Windows PowerShell command to check databases before attaching
You can use the Windows PowerShell cmdlet test-spcontentdatabase before you attach a content database to SharePoint Server 2010 to determine whether any server-side customizations are missing from the environment.
Test-SPContentDatabase [-Identity]
Test-SPContentDatabase -Name
EX:Test-SPContentDatabase -name WSS_Content_DB -webapplication http://sitename
Set the previous version databases to be read-only (database attach with read-only databases)
If you are using the read-only databases hybrid approach to upgrade, set the previous version databases to read-only before you back up the databases. In any type of database attach upgrade, you can also set the databases to read-only temporarily to ensure that you capture all the data in the backup so that you are restoring and upgrading the current state of the environment. If the databases are set to read-only, users can continue to view content, but they will be unable to add or change content.
To set a database to read-only in SQL Server 2000
In SQL Server Enterprise Manager, right-click the name of the database that you want to set to read-only, and then click Properties.
1.In the Properties dialog box, click the Options tab.
2.Under Access, select the Read-only check box, and then click OK.
To set a database to read-only in SQL Server 2005
1.In SQL Server Management Studio, right-click the name of the database that you want to set to read-only, and then click Properties.
2.In the Select a page section, click Options.
3.In the right pane, under Other options, in the State section, next to Database Read-Only, click the arrow, and then select True.
To set a database to read-only in SQL Server 2008
1.In SQL Server Management Studio, in Object Explorer, connect to an instance of the Database Engine, expand the server, and then expand Databases.
2.Select the database that you want to configure to be read-only, right-click the database, and then click Properties.
3.In the Database Properties dialog box, in the Select a page section, click Options.
4.In the right pane, under Other options, in the State section, next to Database Read-Only, click the arrow, and then select True.
Visual Upgrade
A new feature that is available with upgrade allows the server administrator or site owner to determine when and if the new look for SharePoint Server 2010 is used for a particular site collection. Server administrators can choose to adopt the new look and feel for all sites during upgrade, let site owners make the choice after upgrade, or keep the old look and feel for all sites.
If the server administrator lets the site owners decide, after a site is upgraded by using an in-place upgrade, a preview option is available in the site user interface. This option provides a preview of the SharePoint Server 2010 look for the site:
If the owner likes how the site looks and functions, the owner can accept the visual upgrade.
If the owner wants the site to keep the old look and feel, the owner can revert to the Office SharePoint Server 2007 look.
By default, the Office SharePoint Server 2007 look is retained. For more information, see Plan visual upgrade (SharePoint Server 2010).
collected from http://rahulbach.blogspot.in/2010/06/sharepoint-2010-migration.html
Monday, 18 February 2013
Best examples to work with web services
http://developer.yahoo.com/dotnet/howto-xml_cs.html
Using Returned XML with C#
Once you have retrieved data from a web service you will need to do something with it. This HOWTO describes the various built-in methods .NET provides to use XML returned by a web service.
- Overview
- Returned Data to a String
- Using XmlReader
- Using XmlDocument
- Using XPathNavigator/XPathDocument
- Using a DataSet
- Further Reading
Overview
The .NET Framework provides excellent support for XML. Combined with the databinding support of WinForms and ASP.NET applications you have an easy and powerful set of tools. ASP.NET 2.0 takes databinding another step further by providing the
DataSource control which lets you declaratively provide data access to data-bound UI controls.Returned Data to a String
The simplest way to view the returned data is to get the response stream and put it into a string. This is especially handy for debugging. The following code gets a web page and returns the contents as a string.
C# STRING SAMPLE
- public class StringGet
- {
- public static string GetPageAsString(Uri address)
- {
- string result = "";
- // Create the web request
- HttpWebRequest request = WebRequest.Create(address) as HttpWebRequest;
- // Get response
- using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
- {
- // Get the response stream
- StreamReader reader = new StreamReader(response.GetResponseStream());
- // Read the whole contents and return as a string
- result = reader.ReadToEnd();
- }
- return result;
- }
- }
USING XMLREADER
XmlReader provides fast forward-only access to XML data. It also allows you to read data as simple-typed values rather than strings. XmlReader can load an XML document without having to use HttpRequest, though you won't have the same amount of control over the request. If you use HttpRequest, you can just pass the stream returned by the GetResponseStream() method to XmlReader. Fast write-only functions are provided by XmlTextWriter.
With .NET 2.0 you should create
XmlReader instances using the System.Xml.XmlReader.Createmethod. For the sake of compatibility and clarity the next sample uses the .NET 1.1 creation method.C# XMLREADER SAMPLE
- using System.Xml;
- // Retrieve XML document
- XmlTextReader reader = new XmlTextReader("http://xml.weather.yahoo.com/forecastrss?p=94704");
- // Skip non-significant whitespace
- reader.WhitespaceHandling = WhitespaceHandling.Significant;
- // Read nodes one at a time
- while (reader.Read())
- {
- // Print out info on node
- Console.WriteLine("{0}: {1}", reader.NodeType.ToString(), reader.Name);
- }
USING XMLDOCUMENT
XmlDocument gives more flexibility and is a good choice if you need to navigate or modify the data via the DOM. It also works as a source for the XslTransform class allowing you to perform XSL transformations.C# XMLDOCUMENT SAMPLE
- // Create a new XmlDocument
- XmlDocument doc = new XmlDocument();
- // Load data
- doc.Load("http://xml.weather.yahoo.com/forecastrss?p=94704");
- // Set up namespace manager for XPath
- XmlNamespaceManager ns = new XmlNamespaceManager(doc.NameTable);
- ns.AddNamespace("yweather", "http://xml.weather.yahoo.com/ns/rss/1.0");
- // Get forecast with XPath
- XmlNodeList nodes = doc.SelectNodes("/rss/channel/item/yweather:forecast", ns);
- // You can also get elements based on their tag name and namespace,
- // though this isn't recommended
- //XmlNodeList nodes = doc.GetElementsByTagName("forecast",
- // "http://xml.weather.yahoo.com/ns/rss/1.0");
- foreach(XmlNode node in nodes)
- {
- Console.WriteLine("{0}: {1}, {2}F - {3}F",
- node.Attributes["day"].InnerText,
- node.Attributes["text"].InnerText,
- node.Attributes["low"].InnerText,
- node.Attributes["high"].InnerText);
- }
Using XPathNavigator/XPathDocument
XPathDocument provides fast, read-only access to the contents of an XML document using XPath. Its usage is similar to using XPath with XmlDocument.C# XPATHDOCUMENT SAMPLE
- using System.Xml.XPath;
- // Create a new XmlDocument
- XPathDocument doc = new XPathDocument("http://xml.weather.yahoo.com/forecastrss?p=94704");
- // Create navigator
- XPathNavigator navigator = doc.CreateNavigator();
- // Set up namespace manager for XPath
- XmlNamespaceManager ns = new XmlNamespaceManager(navigator.NameTable);
- ns.AddNamespace("yweather", "http://xml.weather.yahoo.com/ns/rss/1.0");
- // Get forecast with XPath
- XPathNodeIterator nodes = navigator.Select("/rss/channel/item/yweather:forecast", ns);
- while(nodes.MoveNext())
- {
- XPathNavigator node = nodes.Current;
- Console.WriteLine("{0}: {1}, {2}F - {3}F",
- node.GetAttribute("day", ns.DefaultNamespace),
- node.GetAttribute("text", ns.DefaultNamespace),
- node.GetAttribute("low", ns.DefaultNamespace),
- node.GetAttribute("high", ns.DefaultNamespace));
- }
Using a DataSet
Using a
DataSet from the System.Data namespace lets you bind the returned data to controls and also access hierarchical data easily. A dataset can infer the structure automatically from XML, create corresponding tables and relationships between them and populate the tables just by calling ReadXml().C# DATASET SAMPLE
- using System.Data;
- public void RunSample()
- {
- // Create the web request
- HttpWebRequest request
- = WebRequest.Create("http://xml.weather.yahoo.com/forecastrss?p=94704") as HttpWebRequest;
- // Get response
- using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
- {
- // Load data into a dataset
- DataSet dsWeather = new DataSet();
- dsWeather.ReadXml(response.GetResponseStream());
- // Print dataset information
- PrintDataSet(dsWeather);
- }
- }
- public static void PrintDataSet(DataSet ds)
- {
- // Print out all tables and their columns
- foreach (DataTable table in ds.Tables)
- {
- Console.WriteLine("TABLE '{0}'", table.TableName);
- Console.WriteLine("Total # of rows: {0}", table.Rows.Count);
- Console.WriteLine("---------------------------------------------------------------");
- foreach (DataColumn column in table.Columns)
- {
- Console.WriteLine("- {0} ({1})", column.ColumnName, column.DataType.ToString());
- } // foreach column
- Console.WriteLine(System.Environment.NewLine);
- } // foreach table
- // Print out table relations
- foreach (DataRelation relation in ds.Relations)
- {
- Console.WriteLine("RELATION: {0}", relation.RelationName);
- Console.WriteLine("---------------------------------------------------------------");
- Console.WriteLine("Parent: {0}", relation.ParentTable.TableName);
- Console.WriteLine("Child: {0}", relation.ChildTable.TableName);
- Console.WriteLine(System.Environment.NewLine);
- } // foreach relation
- }
Subscribe to:
Comments (Atom)