- 博客(52)
- 收藏
- 关注
原创 如何遍历显示一个枚举的内容
using System;public class EnumTest { enum Days { Saturday, Sunday, Monday, Tuesday, Wednesday, Thursday, Friday }; enum BoilingPoints { Celcius = 100, Fahrenheit = 212 }; [FlagsAttribute]
2004-08-12 11:57:00 1772
原创 使用HttpRequest向某网页发送Post请求
private void OnPostInfoClick(object sender, System.EventArgs e){ string strId = UserId_TextBox.Text; string strName = Name_TextBox.Text; ASCIIEncoding encoding=new ASCIIEncoding(); string postData="us
2004-08-10 17:29:00 3515
原创 使用DirectoryServices给文件添加访问权限
using System;using System.Collections;using ActiveDs;namespace PardesiServices.FixFilePermission{ class FileSecurity { [STAThread] static void Main(string[] args) { string strFile =
2004-08-10 17:25:00 1456
原创 在ASP.NET中动态包含文件
原理是使用Response.WriteFile()例如: Response.WriteFile ("Yourfile.inc"); %>
2004-08-10 17:19:00 1478
原创 得到当前运行的dll版本号
using System.Reflection ;using System.Runtime.CompilerServices;...System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString() ;
2004-08-06 11:23:00 1576
原创 DataTable中剔除重复项
今天来论坛上看到思归大哥回帖给的一个链接:HOW TO: Implement a DataSet SELECT DISTINCT Helper Class in Visual C# .NEThttp://support.microsoft.com/default.aspx?scid=kb;EN-US;326176HOW TO: Implement a DataSet SELECT DISTINCT
2004-08-02 15:02:00 1495
原创 将DataView转化成DataTable
public static DataTable GetDataTable(DataView obDataView){ if (null == obDataView) { throw new ArgumentNullException ("DataView", "Invalid DataView object specified"); } DataTable obNewDt = obDataView
2004-08-02 13:42:00 2434
原创 停止或开启系统服务-续(远程调用)
using System; using System.Management; namespace ArLi.CommonPrj { public class Service_WMI { public static readonly System.Version myVersion = new System.Version(1,1);
2004-08-02 10:21:00 1504
原创 用xmlhttp读取webservice提供的dataset并写入table
var iCallID; function init() { service.useService("http://pany/Webapplication1/service1.asmx?WSDL","myMath"); iCallID = service.myMath.callService("getData", "21"); } function onWSres
2004-08-02 10:19:00 1263
原创 访问局域网资源
private void button1_Click(object sender, System.EventArgs e) { ConnectionOptions co = new ConnectionOptions(); co.Username = "Administrator";
2004-08-02 10:18:00 1971
原创 取得局域网内的所有数据库服务器列表
using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; ? using SQLDMO; ? namespace TestSQLDMO { ?????? /// ?????? //
2004-08-02 10:17:00 1288
原创 获取CPU的ID码
public static string GetCPUId() { string cpuInfo = String.Empty; string temp=String.Empty; ManagementClass mc = new Manage
2004-08-02 10:17:00 1922
原创 关于强名称
在命令行,用sn.exe给这个空间生成key 强名称工具有助于使用强名称对程序集进行签名。Sn.exe 提供用于密钥管理、签名生成和签名验证的选项。 sn [-quiet][option [parameter(s)]] 选项说明 -c [csp]将默认加密服务提供程序 (CSP) 设置为用于强名称签名。此设置应用于整台计算机。如果不指定 CSP 名称,则 Sn.exe 将清除当前设置。 -d co
2004-08-02 10:15:00 1288
原创 操作Word的权限问题
//先杀掉你击进程中的word.exe 1.在web.config里面 .....................加入 或 开始->运行->"dcomcnfg"->在应用程序列表框中选择“Microsoft Excel 应用程序”-> “安全性”->选择“使用自定义访问权限”,点击“编辑”按钮添加本地“ASPNET”用户,权限为“允许访问
2004-08-02 10:13:00 3677
原创 鼠标移动时行变色并可以点击行时选中行
//第一列需要放置一个LinkButton列用来选中行private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) { if(e.Item.ItemType==ListItemType.
2004-08-02 10:10:00 1272
原创 Word中画表格
Word.Table oTable; Word.Range wrdRng = oDoc.Bookmarks.get_Item(ref oEndOfDoc).Range; oTable = oDoc.Tables.Add(wrdRng, 3, 5, ref oMissing, ref oMissing); oTable.Range.ParagraphForm
2004-08-02 10:04:00 1662
原创 将数据库压缩同时设置密码
引用Microsoft Jet and Rel.........,dll名为msjro.dll ... 然后using JRO; JetEngine x = new JetEngine(); x.CompactDatabase("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=e://db.mdb;Jet OLEDB:Database Password=1
2004-08-02 10:03:00 1206
原创 无法在web服务器上启动调试
原因可能是在域控制器上安装的.NET,ASPNET账号(启动aspnet_wp.exe账号)没有足够的创建进程的权限所致。 请尝试如下几种方法: 方法1: 将账号ASPNET加入本机管理员中。 方法2: 进入/WINNT/Microsoft.NET/Framework/Version/Config目录,打开machine.config文件。找到processModel项,将其中usern
2004-08-02 10:01:00 3166 2
原创 ASP.net如何访问域用户信息
//没AD也没关系,不用LDAP,用WinNT服务也可以的 using System.DirectoryServices; DirectoryEntry objDE; objDE=new DirectoryEntry("WinNT://servername","username","password",System.DirectoryServices.AuthenticationTyp
2004-08-02 10:00:00 1521
原创 无法创建Web项目"WebApplication1
1. Launch the Internet Information Services MMC. 2. Right click on your web site and click properties. 3. In the HTTP Headers tab click MIME Types... button. 4. Add a new MIME type by clicking Ne
2004-08-02 09:59:00 1631
原创 委托(Delegate)
C# 中的委托类似于 C 或 C++ 中的函数指针。使用委托使程序员可以将方法引用封装在委托对象内。然后可以将该委托对象传递给可调用所引用方法的代码,而不必在编译时知道将调用哪个方法。与 C 或 C++ 中的函数指针不同,委托是面向对象、类型安全的,并且是安全的。 委托声明定义一种类型,它用一组特定的参数以及返回类型封装方法。对于静态方法,委托对象封装要调用的方法。对于实例方法,委托对象同时封装
2004-08-02 09:58:00 20086 4
原创 在域控制器中使用默认ASPNET 帐户时ASP.NET 不能正常运行
在域控制器或备份域控制器上安装Microsoft Visual Studio .NET 或Microsoft .NET 框架后,如果您尝试运行 ASP.NET 应用程序,则浏览器会显示下面的错误信息: Server Application Unavailable The web application you are attempting to access on this web server
2004-08-02 09:56:00 1705
原创 在asp.net中计算叶面执行所耗时间
language="C#" runat=server> DateTime startTime; void Page_Init (Object sender, EventArgs e) { startTime = DateTime.Now; //Response.Write("page init"); } protected override
2004-08-02 09:54:00 962 1
原创 在UserControl中调用所在页面的ViewState
这样实现:Page mypage = (Page)System.Web.HttpContext.Current.Handler; string s = (string) mypage.ViewState["Whatever"];
2004-08-02 09:50:00 905
原创 文件下载时出现提示框不直接打开
//读取文件输出它 string strFile = "c://abc.doc"; FileStream fs = new FileStream(strFile, FileMode.Open); byte[] bytes = new byte[(int)fs.Length]; fs.Read(bytes, 0, bytes.Length); fs.Close(); Response.Content
2004-08-02 09:48:00 2118
原创 Joke
大家喝的是啤酒。这时你入座了。 你给自己倒了杯可乐,这叫低配置。 你给自已倒了杯啤酒,这叫标准配置。 你给自己倒了杯茶水,这茶的颜色还跟啤酒一样,这叫木马。 你给自己倒了杯可乐,还滴了几滴醋,不仅颜色跟啤酒一样,而且不冒热气还有泡泡,这叫超级木马。 你的同事给你倒了杯白酒,这叫推荐配置。 人到齐了,酒席开始了。 你先一个人喝了一小口,这叫单元测试。 你跟旁边的人说哥
2004-07-30 13:04:00 984
原创 停止或开启系统服务
using System; using System.Management; namespace ArLi.CommonPrj { public class PLMM007_WMI { public static readonly System.Version myVersion = new System.Version(1,1);
2004-07-29 18:10:00 1482
原创 aspnet中获得图片的大小
System.Drawing.Image imgPhoto = System.Drawing.Image.FromFile(Server.MapPath(yourFile)); int sourceWidth = imgPhoto.Width; int sourceHeight = imgPhoto.Height;
2004-07-29 18:08:00 1064
原创 ASP.NET服务器端异步Web方法
ASP.NET服务器端异步Web方法http://www.microsoft.com/china/msdn/archives/library/dnservice/html/service10012002.asp
2004-07-29 18:07:00 814
原创 Asp.net中基于Forms验证的角色验证授权
http://dev.csdn.net/develop/article/18/18958.shtmhttp://support.microsoft.com/default.aspx?kbid=306590&product=aspnethttp://www.codeproject.com/aspnet/formsroleauth.asp
2004-07-29 18:04:00 881
原创 如何使用C#连接dbf数据库
samples:string connStr="PWD=;SourceType=DBF;UID=;Collate=Machine;Deleted=Yes;BackgroundFetch=Yes;Exclusive=No;Driver=Microsoft Visual FoxPro Driver;Null=Yes;SourceDB=h://"; OdbcConnection conn=new O
2004-07-29 17:59:00 4166 1
原创 如何使用 Visual C# .NET 检查 Windows 版本[转]
获取 Windows 版本数据获取 Windows 系统信息判断平台判断 Windows 95, Windows 98, Windows 98 第二版或 Windows Me 的版本判断 Windows NT, Windows 2000, 或 Windows XP 的版本编译样例 -----------------------------------------------------------
2004-07-29 17:55:00 948
原创 byte[]转换成16进制字符串的高效方法或算法
static char[] hexDigits = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F}; public static string ToHexString(byte[] bytes) { char[] chars = new char[byte
2004-07-29 12:54:00 1539 1
原创 获取本地主机IP地址
String strHostName = Dns.GetHostName(); IPHostEntry iphostentry = Dns.GetHostByName(strHostName); int nIP = 0; foreach(IPAddress ipaddress in iphostentry.AddressList) { Console.WriteLine
2004-07-29 12:53:00 1791 3
原创 如何控制生成的XML中的编码
如何让我写的Xml文件第一行变成我想要的 ?-------XmlTextWriter writer = new XmlTextWriter( path, System.Text.Encoding.UTF8);writer.WriteStartDocument(); writer.WriteStartElement( "Entity" ); writer.WriteEndElement(); w
2004-07-29 12:49:00 1489
原创 获取一个类的所有属性、方法的名字
use reflection:---------------------namespace reflect{using System ;using System.Reflection ; public class ClassA{ public static int Main ( string[] kami ) { Type t = typeof( test ) ; Console
2004-07-29 12:47:00 1237
原创 访问远程access数据库总弹出的对话框
---比如有a、b两台机子,在a机上有access数据库,共享在//a//exam//水位.mdb 。 现在在b机编写程序访问之。conn = new OleDbConnection();conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=//a//exam//水位.mdb ";conn.Open();---
2004-07-29 12:46:00 1268
原创 在aspx发送前记录下生成的html
重写Render:StringBuilder sbPage = new StringBuilder();TextWriter tw = (TextWriter) new StringWriter(sbPage);System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);base.Render(hw);string
2004-07-29 12:45:00 1414
原创 用Visual C#创建Windows服务程序
参考:用Visual C#创建Windows服务程序http://www.vchome.net/dotnet/dotnetdocs/dotnet38.htm注意安装时安装类里面选择的用户是LocalSystem-------------------------------------------------------------------------- 用Visual C#创建Windows
2004-07-29 12:42:00 1475
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人