随笔分类 -  C#web应用知识

摘要:string sql = "SELECT id,name FROM content FOR XML AUTO,XMLDATA"; SqlConnection conn =new SqlConnection( System.Configuration.ConfigurationSettings.AppSettings["testDataBase"] ); SqlCommand cmd=new SqlCommand(sql,conn); conn.Open(); XmlTextReader objXmlReader = (XmlTextReader)cmd. 阅读全文
posted @ 2010-08-31 00:31 小锋神 阅读(511) 评论(0) 推荐(0)
摘要:程序实现功能:1.读取数据,点解“获取”按钮动态生成XML格式的文档,并把生成的文档放在TEXTBOX或者生成一个XML文件。2.点击“浏览”按钮,把获取到的XML格式文档,转换成HTML,在浏览器中显示。首先在ASPX对应的CS文件中引入using System.Xml;int m = 0; int loop = 0;//根据指定的获取深度DEPTH获取用于生成XML文档的数据private int initData(string[] parent, string[] guid, string[] path, string[] name, ChannelCollection cc,int d 阅读全文
posted @ 2010-08-31 00:30 小锋神 阅读(1807) 评论(0) 推荐(0)
摘要:今天在写自己的CMS系统时,需要生成一个网站有KEY,其中一种方法就是让客户把生成的KEY直接下载后放到网站根目录下,这样主要是方便一些内网的网站。那怎样动态生成XML文档并提供下载呢?其他这种原理和生成EXECL一样。代码如下: int insertID=3; string domain="www.w17x.com"; string enddate="2009-12-1"; string Dcode="xlxcn"; string xml = "<key>\r\n" + @"<webi 阅读全文
posted @ 2010-08-31 00:26 小锋神 阅读(1334) 评论(0) 推荐(0)
摘要:网上有好多ASP.NET读取XML的例子,比如使用Dataset来读取,但本文教程却是使用XmlDocument来读取XML节点下所有数据,我们先来看下这个XML格式:SysRightsDb.xmlXML Code [http://www.xueit.com]<?xml version="1.0" encoding="utf-8" ?><root> <rights name="SYS"> <xml name="股票行情" code="stockmarket&quo 阅读全文
posted @ 2010-08-31 00:23 小锋神 阅读(1316) 评论(0) 推荐(0)
摘要:MaintainScrollPositionOnPostback="true"如内容超出单元格,则隐藏 style="TABLE-LAYOUT: fixed"让弹出窗口总是在最上面: <body onblur="this.focus();">不要滚动条? 让竖条没有: <body style='overflow:scroll;overflow-y:hidden'> </body>让横条没有: <body style='overflow:scroll;overflow-x 阅读全文
posted @ 2010-08-28 09:28 小锋神 阅读(388) 评论(0) 推荐(0)
摘要:private DataSet InExecl() { //string filename = get.filenames; //string filename =get.filenames ; string filename = Label23.Text; DataSet ds = new DataSet(); string connStr = "Provider=Microsoft.Ace.OleDb.12.0;Data Source=" + Server.MapPath("up_product_store" + "\\" + f 阅读全文
posted @ 2010-08-27 22:01 小锋神 阅读(311) 评论(0) 推荐(0)
摘要:.NET 读取Excel 2007的xlsx文件和读取老的.xls文件是一样的,都是用Oledb读取,仅仅连接字符串不同而已。读取xlsx 用的是Microsoft.Ace.OleDb.12.0;具体操作方法如下:public static DataTable GetExcelToDataTableBySheet(string FileFullPath, string SheetName){ //string strConn = "Provider=Microsoft.Jet.OleDb.4.0;" + "data source=" + FileFull 阅读全文
posted @ 2010-08-27 13:00 小锋神 阅读(5772) 评论(2) 推荐(3)
摘要:foreach (Control c in Page.Controls) { foreach (Control childc in c.Controls) { if (childc is LinkButton) { string pp = ((LinkButton)childc).Text; //Response.Write(pp ); try { //((LinkButton)childc).Text = (int.Parse(((LinkButton)childc).Text) + 10).ToString(); int pp2 = int.Parse(((LinkButton)chil. 阅读全文
posted @ 2010-08-24 22:20 小锋神 阅读(477) 评论(0) 推荐(0)
摘要:1)10表示间隔10秒刷新一次2)<script>window.location.reload(true);</script>如果是你要刷新某一个iframe就把window给换成frame的名字或ID号3)<script>window.navigate("本页面url");</script>4>function abc(){window.location.href="/blog/window.location.href";setTimeout("abc()",10000);} 刷 阅读全文
posted @ 2010-08-24 20:55 小锋神 阅读(878) 评论(0) 推荐(0)
摘要:给一个网址传递参数,并接收返回的参数。 public string SendMsg(string user,string password,string phone,string text) { try { //if (!Regex.IsMatch(phone, @"^(13|15)\d{9}$")) // return "手机号码格式错误!"; string url = "http://www.xunsai.net:8000/"; string param = "user=" + user+ "& 阅读全文
posted @ 2010-08-24 20:53 小锋神 阅读(2236) 评论(0) 推荐(0)
摘要:1 using System;2 using System.Data;3 using System.Configuration;4 using System.Collections;5 using System.Web;6 using System.Web.Security;7 using System.Web.UI;8 using System.Web.UI.WebControls;9 using System.Web.UI.WebControls.WebParts;10 using System.Web.UI.HtmlControls;11 12 public partial class 阅读全文
posted @ 2010-08-23 21:57 小锋神 阅读(645) 评论(0) 推荐(1)
摘要:public static bool AddOfficialCaseRegisters(string path)//选择导出的路径 { List<DataTable> dt = GetLeadinExcel(path); int z = 0; for (int i = 2; i < dt[0].Rows.Count; i++) { string sql1 = string.Format("select * from OfficialCaseRegisters where Identitycard='{0}' and FillTime='{1} 阅读全文
posted @ 2010-08-23 21:46 小锋神 阅读(443) 评论(0) 推荐(0)