11 2010 档案
摘要:if (drt.HasRows) { while (drt.Read()) { ddl_color.Items.Add(drt.GetString(0));//绑定第一个字段 } Label68.Visible = false; }
阅读全文
摘要:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->一、基础1、说明:创建数据库CREATE DATABASE database-name 2、说明:删除数据库drop database dbname3、说明:备份sql server--- 创建 备份数据的 deviceUSE masterEXEC sp_addumpdevice 'disk', 'testBack', 'c:\mssql7backup\M
阅读全文
摘要:--定时同步服务器上的数据--例子:--测试环境,SQL Server2000,远程服务器名:xz,用户名为:sa,无密码,测试数据库:test--服务器上的表(查询分析器连接到服务器上创建)create table [user](id int primary key,number varchar(4),name varchar(10))go--以下在局域网(本机操作)--本机的表,state说明:null 表示新增记录,1 表示修改过的记录,0 表示无变化的记录if exists (select * from dbo.sysobjects where id = object_id(N'
阅读全文
摘要:SQL2000我有表tb1,tb2,tb3tb1的字段product_no,color,product_size,orderno,tb2字段joinno,orderno,product_infotb3字段,product_no,product_type那么我想更新表tb2的字段product_info是根据orderno字段去查询tb1表的product_no,color,product_size,再根据tb1的product_no去查询tb3的product_type,最后后成product_info字段内容为product_no-color-product_size-product_typ
阅读全文
摘要:select * from t1 where id in(select min(id) from t1 group by name)SELECT * FROM t1 a WHERE [time]= ( SELECT TOP 1 [time] FROM t1 WHERE name=a.name ORDER BY [Time] DESC )Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->--按某一字段分组取最大(小)值所在行的数据/*数据如下:n
阅读全文
摘要:1. 打开新的窗口并传送参数: 传送参数: response.write("<script>window.open('*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"')</script>") 接收参数: string a = Request.QueryString("id"); string b = Request.QueryString("id1"); 2.为按钮添加对话框 Button1.Attribu
阅读全文
摘要://光棒效果 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#FFFDD7'"); e.Row.Attributes.A
阅读全文
摘要:/// <summary> /// 遍历 rootdir目录下的所有文件 /// </summary> /// <param name="rootdir">目录名称</param> /// <returns>该目录下的所有文件</returns> public StringCollection GetAllFiles(string rootdir) { StringCollection result = new StringCollection(); GetAllFiles(rootdir, resul
阅读全文
摘要:SELECT *FROM tbl_product_storeWHERE (SUBSTRING(product_no, 2, 1) = '8')查询字段product_no第二位起到第三位字段是8 的数据
阅读全文
摘要:1.只要求保留N位不四舍5入 float f = 0.55555f; int i =(int)(f * 100); f = (float)(i*1.0)/100; 2.保留N位,四舍五入 . decimal d= decimal.Round(decimal.Parse( "0.55555 "),2); 3.保留N位四舍五入 Math.Round(0.55555,2) 4,保留N位四舍五入 double dbdata = 0.55555; string str1 = dbdata.ToString( "f2 ");//fN 保留N位,四舍五入 5.保留N位
阅读全文
摘要:protected void Page_Load(object sender, EventArgs e) { str_product(); } conn co = new conn(); public void str_product() { //用SQL语句查询数据并转换成XML文档,保存起来 string str_pro = "select distinct(product_no),brand,product_type,product_class,price,price2,price4,memo from tbl_product_store where brand='KI
阅读全文
摘要:代码Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->一、简单介绍using System.Xml;//初始化一个xml实例XmlDocument xml=new XmlDocument();//导入指定xml文件xml.Load(path);xml.Load(HttpContext.Current.Server.MapPath("~/file/bookstore.xml"));//指定一个节点XmlNode root=xm
阅读全文
摘要:合并列值 --*******************************************************************************************表结构,数据如下: id value ----- ------ 1 aa 1 bb 2 aaa 2 bbb 2 ccc 需要得到结果: id values ------ ----------- 1 aa,bb 2 aaa,bbb,ccc 即:group by id, 求 value 的和(字符串相加) 1. 旧的解决方法(在sql server 2000中只能用函数解决。) --===========
阅读全文
摘要:T_SQL语句复制表的方法我在SQL SERVER 2000中有现个数据库DATAHR及DEMO,它们的结构是一样,其它有一个表名为:GBITEM.现在我想将DEMO数据库的表名:GBITEM的全部内容复制到DATAHR数据库的表名为:GBITEM中。请问此T-SQL语句应该怎么写? 谢谢高人指点!如果目的表已经存在:insert into DATAHR.DBO.GBITEMselect * from DEMO.DBO.GBITEM如果目的表不存在:select * into DATAHR.DBO.GBITEMfrom DEMO.DBO.GBITEM--备份数据库OFSysBACKUP DAT
阅读全文
摘要:<html><head><title>正在载入...</title><meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0"><table border=0 cellpadding=0 cellspacing=0
阅读全文
摘要:其实我的方法非常简单,也可以说没什么技术含量,甚至还不支持IE6,但据我长期的观察,确实非常实用的。Analytics的统计数据表明,加入了这一效果之后,用户的“平均停留时间”的确有所提高。可见,一个“正在加载”让许多用户都有更多的耐心等待,而不会因为屏幕空白太久而不耐烦地离开。最近,又有不少朋友留言询问这个Loading的实现原理。这里我就分享一下...
阅读全文
摘要:答案一Page.Request.UrlReferrer.ToString()答案二本页地址: Request.URL; 上页地址: Request.UrlReferrer Request.ServerViables["http_referer"] Request.RawUrl Request.RawUrl.QueryAndPath System.IO.Path.GetFileName(Request.FilePath.ToString()) <script> var url = document.location.href; </script>
阅读全文
摘要:举一个Northwind的例子。DECLARE @m_LastName nvarchar(20)DECLARE @Sql varchar(256)SET @m_LastName = 'Fuller'SET @Sql = 'SELECT * FROM Employees WHERE LastName='+ char(39) + @m_LastName + char(39) EXEC(@Sql)注意,要加上char(39)就可以了。
阅读全文
摘要:以前拼接的写法set @sql=' select * from table where 1=1 'if (@addDate is not null) set @sql = @sql+' and addDate = '+ @addDate + ' ' if (@name <>'' and is not null) set @sql = @sql+ ' and name = ' + @name + ' 'exec(@sql)下面是 不采用拼接SQL字符串实现多条件查询的解决方案第一种写法是
阅读全文
摘要:XmlDocument doc = new XmlDocument();XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", "UTF-8", null);doc.AppendChild(dec);XmlElement root = doc.CreateElement("BookInfo");doc.AppendChild(root);XmlElement isbn = doc.CreateElement("ISBN");isbn.InnerText = &quo
阅读全文
摘要:AutoCompleteExtender只是ASP.NET AJAX控件工具包众多控件中的一个。表32-7列出了当前可用的控件扩展器,而表32-8列出了所有控件。表32-7 ASP.NET AJAX控件工具包中的控件扩展器名称描述AlwaysVisibleControlExtender这个扩展器能够把控件固定在某一特定位置(如网页的左上角),即使用户滚动页面也是如此AnimationExtender这个强大而灵活的扩展器可以给大小调整、移动、淡出、颜色变化等单独或组合添加动画AutoCompleteExtender客户端扩展器可以根据用户的部分输入提供建议列表。在前一节介绍过,列表内容完全由一
阅读全文
摘要:用的是一种很笨的方法,但可以帮助初学者了解访问XML节点的过程。 已知有一个XML文件(bookstore.xml)如下:<?xml version="1.0" encoding="gb2312"?><bookstore> <book genre="fantasy" ISBN="2-3631-4"> <title>Oberon's Legacy</title> <author>Corets, Eva</author> <
阅读全文