Archive

Archive for June 20, 2008

Generating an XML Schema of SQL Server 2005 Database

I was told to generate an XML Schema of an SQL Server 2005 Database. And naturally I started googling it out so I found this at a blog given by the URL at the bottom.

Thumbs up to ya my friend!

create table Person
(
Age int not NULL check( Age > 0) ,
Height numeric(10,2) not NULL check( Height > 5),
Gender varchar(5) not null check( Gender in (‘M’, ‘F’, ‘O’)),
BirthDate datetime null,
)
DECLARE @schema xml
SET @schema = (SELECT * FROM Person FOR XML AUTO, ELEMENTS, XMLSCHEMA(‘PersonSchema’))
select @schema
OUTPUT:

http://dwightrau.blogspot.com/2008/02/generate-or-create-xsd-schema-from.html

Programmatically selecting multiple items in a ListBox Control

I’m working on a project in which there was an IndexOutOfBound exception coming. We needed to have multiple items selected in the ListBox. It had a table, TemplateMTemplateAttribute , in which there were multiple entries of the template attributes selected. It was actually the TemplateAttributeId that was to be matched with those in the ‘Value’ property of the ListBox, lbProductAttributes. So I wrote this code

TemplateMTemplateAttribute oPA = null;

oPA = new TemplateMTemplateAttribute();

oPA.Query.Where(oPA.Query.TemplateId.Equal(Request.QueryString["tid"]));
int index = 0;
DataTable dt = oPA.Query.LoadDataTable();
if (dt != null)
{
foreach (DataRow dr in dt.Rows)
{
index = 0;
foreach (ListItem li in lbProductAttributes.Items)
{
if (li.Value.Equals(dr["TemplateAttributeId"].ToString()))
{
lbProductAttributes.Items[index].Selected = true;

}
index++;
}
}
}

How to Left, Right, Center Align With CSS

http://www.communitymx.com/content/article.cfm?cid=529B0

http://www.ehow.com/how_2284643_left-right-center-align-css.html

body {
width: 80%;
margin-right: auto;
margin-left: auto;
border: 1px solid black;

}

.container {
position: relative;
height: 50px;
}

.left-element {
position: absolute;
left: 0;
width: 50%;
}

.right-element {
position: absolute;
right: 0;
width: 50%;
text-align: right; /* depends on element width */
}

Download Samples

Categories: CSS Tags: ,