source

88dd 2003-04-03 10:10:06

System.Data.DataSet dataSet = new System.Data.DataSet();
try
{
string connStr = "server=(local);User ID=sa;Password=;database=Northwind";
string SQL = "SELECT TOP 2 * FROM Employees WHERE Country='UK'";
System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection( connStr );
System.Data.SqlClient.SqlDataAdapter adapter = new System.Data.SqlClient.SqlDataAdapter();
adapter.SelectCommand = new System.Data.SqlClient.SqlCommand( SQL, conn );
adapter.Fill( dataSet, "Employees" );

System.Data.DataRow dataRow = dataSet.Tables["Employees"].Rows[0];
dataSet.Tables["Employees"].Rows[0]["FirstName"] = "Buddy";
//dataRow( 1, System.Data.DataRowVersion.Original ) = "any";

//System.Data.SqlClient.SqlCommandBuilder sqlCommandBuilder = new System.Data.SqlClient.SqlCommandBuilder( adapter );
adapter.UpdateCommand = new System.Data.SqlClient.SqlCommand( "UPDATE Employees SET FirstName = @FirstName", conn );
adapter.UpdateCommand.CommandType = System.Data.CommandType.Text;
System.Data.SqlClient.SqlParameter parameter = new System.Data.SqlClient.SqlParameter( "@FirstName", System.Data.SqlDbType.NVarChar, 20 );
parameter.SourceColumn = "FirstName";
adapter.UpdateCommand.Parameters.Add( parameter );

adapter.Update( dataSet, "Employees" );
}
catch( Exception e )
{
int a = 0;
}
return dataSet;
...全文
47 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
88dd 2003-04-06
  • 打赏
  • 举报
回复


function tree()
{
{
this.prototype =
{
isRoot : true,
isExpand : true,
isLastItem : true,
onConstruct : function()
{
callSuper( this );
//this.hideCaption();
//this._container.style.marginLeft = 5;
//this._container.style.marginTop = 5;
//this.host.style.backgroundImage = "";
},
onUIReady : function()
{
this.host.style.cursor = "default";
this.attachEvent( this.host, "mouseover", this.onMouseOver );
this.attachEvent( this.host, "mouseout", this.onMouseOut );
this.attachEvent( this.host, "click", this.onClick );
//this.attachEvent( this._container, "mouseover", this.onMouseOver );
//this.attachEvent( this._container, "mouseout", this.onMouseOut );
//this.attachEvent( this._container, "click", this.onClick );
},
onMouseOver : function()
{
var __srcElement = event.srcElement;
var __treeItem = __srcElement.__treeItem;
if ( __treeItem && __srcElement == __treeItem._body )
{
__srcElement.style.backgroundColor = "#CCCCCC";
__srcElement.style.border = "1px solid #999999";
}
},
onMouseOut : function()
{
var __srcElement = event.srcElement;
var __treeItem = __srcElement.__treeItem;
if ( __treeItem && __srcElement == __treeItem._body )
{
//__srcElement.className = __treeItem.isFocus ? "clsCurrentHasFocus" : "clsMouseOut";
__srcElement.style.backgroundColor = "";
__srcElement.style.border = __treeItem.isFocus ? "1px solid #999999" : "1px solid white";
}
},
onClick : function()
{
var __srcElement = event.srcElement;
var __treeItem = __srcElement.__treeItem;
if ( __treeItem )
{
if ( __srcElement == __treeItem._head )
{
if ( __treeItem.isExpand )
{
__treeItem.collapse();
}
else if ( __treeItem.items )
{
__treeItem.expand();
}
}
if ( __srcElement == __treeItem._body )
{
this.setFocusNode( __treeItem );
__treeItem.fireAction();
}
}
},
setFocusNode : function( __treeItem )
{
if ( this.focusNode )
{
this.focusNode._setFocus( false );
}
__treeItem._setFocus( true );
this.focusNode = __treeItem;
}
}
}
}

this.prototype =
{
caption : "Virtual Root",
src : "XML/treeBoard.xml",
onConstruct : function()
{
callSuper( this );
this.loadChildItems();
//this._hideCaption();
//this.setPadding(0);
this.putTo( document.body );
}
}
88dd 2003-04-06
  • 打赏
  • 举报
回复
function treeNode()
{
{
this.prototype =
{
key : null,
value : null,
caption : null,
action : null,
src : null,
href : null,
items : null,
visible : true,
_lastItem : null,
_captionVisible : false,
isExpand : false,
isFocus : false,
isRoot : false,
isLastItem : false,
_head : null,
_symbol : null,
_body : null,
_container : null,
_icon : null,
_padding : false,
onConstruct : function()
{
callSuper( this );
},
getUI : function()
{
this.host = this.win.document.createElement( "<DIV></DIV>" );
this._head = this.win.document.createElement( "<IMG width=18 height=16 src='" + _.appDir + "images/tree_chain_middle.gif'>" );
this._icon = this.win.document.createElement( "<IMG width=16 height=16 src='" + _.appDir + "images/icon_folder.gif'>" );
this._body = this.win.document.createElement( "<SPAN style='position:relative;top:-3px;margin-left:3px;font-size:12px;font-family:verdana;border:1px solid white;padding-left:3px;padding-right:3px;'></SPAN>" );
this._captionContainer = this.win.document.createElement( "<DIV style='height:16px;' noWrap></DIV>" );
this._captionContainer.style.overflowY = "hidden";
this._container = this.win.document.createElement( "<DIV style='display:none;padding-left:18px;background-image:url(" + _.appDir + "images/tree_chain_children.gif)' ></DIV>" );

this._container.style.backgroundRepeat = "repeat-y";

this._captionContainer.appendChild( this._head );
this._captionContainer.appendChild( this._icon );
this._captionContainer.appendChild( this._body );
this.host.appendChild( this._captionContainer );
this.host.appendChild( this._container );

this._head.__treeItem = this;

this._body.__treeItem = this;
this._container.__treeItem = this;

this._body.innerText = this.caption;
this.fire( this.onUIReady );
return this.host;
},
appendItem : function( __treeItem )
{
if ( !this.items ) this.items = [];
if ( !this.items[__treeItem.key] )
{
this.items[this.items.length] = __treeItem;
if ( this._lastItem )
{
this._lastItem.isLastItem = false;
}
this._lastItem = __treeItem;
__treeItem.isLastItem = true;
}
},
removeChild : function( __oNode )
{
},
removeAll : function()
{
},
fireAction : function()
{
if ( this.href )
{
}
},
expand : function()
{
this._container.style.display = "";
this._head.src = _.appDir + "images/tree_symbol_expand.gif";
//this.host.parentElement.style.display = "none";
//this.host.parentElement.style.display = "";
this.host.parentElement.style.visibility = "hidden";
this.host.parentElement.style.visibility = "visible";
this.isExpand = true;
},
collapse : function()
{
this._container.style.display = "none";
this._head.src = _.appDir + "images/tree_symbol_collapse.gif";
//this._container.parentElement.style.display = "none";
//this._container.parentElement.style.display = "";
this.host.parentElement.style.visibility = "hidden";
this.host.parentElement.style.visibility = "visible";
this.isExpand = false;
},
show : function()
{
this.host.style.display = "";
this.visible = true;
},
hide : function()
{
this.host.style.display = "none";
this.visible = false;
},
setCaption : function( __strCaption )
{
this.caption = __strCaption;
if ( this.host )
{
this._body.innerText = __strCaption;
}
},
_hideCaption : function()
{
this._chain.style.display = this._icon.style.display = this._head.style.display = this._body.style.display = "none";
},
showCaption : function()
{
this._head.style.display = this._body.style.display = "";
},
putTo : function( __oContainer )
{
__oContainer.appendChild( this.getUI() );
this._captionContainer.removeChild( this._head );
this._container.style.paddingLeft = 0;
this.reDraw( 10 );
__oContainer.style.padding = 3;
},
_setFocus : function( __bFocus )
{
this.isFocus = __bFocus;
this._body.style.border = __bFocus ? "1px solid #999999" : "1px solid white";
},
setPadding : function( __bShow )
{
var a = 0;
this._container.style.paddingLeft = __bShow ? 16 : "0px";
this._container.style.backgroundImage = __bShow ? "background-image:url(" + _.appDir + "images/tree_chain_children.gif)" : "";
},
reDraw : function( __nDeeps )
{
if ( __nDeeps == 0 ) return;
if ( !__nDeeps ) __nDeeps = 1;

var __backgroundImage = this.isLastItem ? "url()" : "url(" + _.appDir + "images/tree_chain_children.gif)";
this._container.style.backgroundImage = __backgroundImage;
this._head.style.backgroundImage = "url(" + _.appDir + ( this.isLastItem ? "images/tree_chain_bottom.gif" : "images/tree_chain_middle.gif" ) + ")";

var __src;
if ( this.isExpand )
{
this.expand();
}
else
{
if ( this.items || this.src )
{
__src = _.appDir + "images/tree_symbol_collapse.gif";
}
else
{
__src = _.appDir + "images/space.gif";
}
this._head.src = __src;
}

var __oUI;
if ( this.items )
{
for ( var i=0; i<this.items.length; i++ )
{
__oUI = this.items[i].getUI();
if ( __oUI.parentElement != this._container )
{
this._container.appendChild( __oUI );
this.items[i].reDraw( __nDeeps - 1 );
}
}
//this._lastItem._container.style.backgroundImage = "url()";
//this._lastItem._chain.src = "";
}
},
getRoot : function()
{
},
loadChildItems : function()
{
//var oXml = new ActiveXObject( "MSXml2.DOMDocument" );
if ( this.onLoadChildItems() && typeof this.src == "string" && "" != this.src )
{
var __oXmlDom = new ActiveXObject( "Microsoft.XMLDOM" );
__oXmlDom.async = false;
__oXmlDom.load( this.src );
var __oXmlRoot = __oXmlDom.documentElement
this.createChildItems( __oXmlRoot );
}
},
onLoadChildItems : function()
{
return 1;
},
initItem : function( __oXmlNode )
{
this.caption = __oXmlNode.getAttribute( "caption" );
this.key = __oXmlNode.getAttribute( "key" );
this.href = __oXmlNode.getAttribute( "href" );
var __strExpand = __oXmlNode.getAttribute( "expand" );
__strExpand = __strExpand ? __strExpand.toLowerCase() : 1;
this.isExpand = ( __strExpand == 1 || __strExpand == "yes" || __strExpand == "true" ) ? true : false;
if ( !__oXmlNode.childNodes.length )
{
this.isExpand = false;
}
},
createChildItems : function( __oXmlNodeParent )
{
var __oTreeNode;
var __oXmlNode;
var __strID;
for ( var i=0; i<__oXmlNodeParent.childNodes.length; i++ )
{
__oXmlNode = __oXmlNodeParent.childNodes[i];
__strID = __oXmlNode.getAttribute( "id" );
if ( !__strID )
{
__strID = api.getUniqueID();
}
__oTreeNode = this.construct( treeNode, __strID );
if( __oTreeNode )
{
__oTreeNode.initItem( __oXmlNode );
this.appendItem( __oTreeNode );
__oTreeNode.createChildItems( __oXmlNode );
}
}
}
}
}
}
gweidian 2003-04-03
  • 打赏
  • 举报
回复
What?

110,536

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧