博文

身份证15To18 的算法(C#)(2009-01-12 16:37:00)

摘要:using System;
using System.Threading;
namespace KeyboardRecord
{
/// <summary>
/// Class1 的摘要说明。
/// </summary>
class Class1
{

/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main(string[] args)
{
//
// TODO: 在此处添加代码以启动应用程序
//
string a = Console.ReadLine();

if (a.Length!=15)
{
Console.WriteLine("Please input correct idnumber");
}
else
{
Console.WriteLine(getCheckCode(a));
}

}
static string getCheckCode(string sfzh)
{
char[] strJiaoYan = {''1'', ''0'', ''X'', ''9'', ''8'', ''7'', ''6'', ''5'', ''4'', ''3'', ''2''};
int[] intQuan = {7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2, 1};
string strTemp;
int intTemp = 0;

strTemp = sfzh.Substring(0,6) + "19" + sfzh.Substring(6);
for (int i=0;i<=strTemp.Length-1;i++)
{
intTemp += int.Parse(strTemp.Substring(i,1))*intQuan[i];
}
intTemp = intTemp % 11;
ret......

阅读全文(929) | 评论:0

对本站博客栏目功能项出现问题的修改建议(2009-01-12 10:48:00)

摘要:问题                描述                                 评价 第一个问题:数据生成速度                  慢 第二个问题:新博客模板数据生成      糟糕    ......

阅读全文(590) | 评论:0

实现---万年历--功能样式源代码(2009-01-12 10:39:00)

摘要:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0031)http://jxj.cmaya.com/wy/wjl.htm -->
<HTML><HEAD><TITLE>万年历查询表</TITLE>
<META
content="农历; 万年历; 月历; 节日; 时区; 节气; 八字; 干支; 生肖; gregorian solar; chinese lunar; calendar;"
name=keywords>
<META content=All name=robots>
<META content="gregorian solar calendar and chinese lunar calendar"
name=description>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<STYLE type=text/css>P {
 FONT-SIZE: 9pt; FONT-FAMILY: 宋体
}
TD {
 FONT-SIZE: 9pt; FONT-FAMILY: 宋体,simsun
}
A:link {
 COLOR: #000000; TEXT-DECORATION: none
}
A:visited {
 COLOR: #000000; TEXT-DECORATION: none
}
A:active {
 COLOR: green; TEXT-DECORATION: none
}
A:hover {
 COLOR: red; TEXT-DECORATION: underline
}
</STYLE> <SCRIPT language=JavaScript>

阅读全文(1912) | 评论:0

触发器(2008-11-03 11:04:00)

摘要:  Ø一种特殊类型的存储过程, Ø不同于存储过程。 Ø触发器主要是通过事件进行触发而被自动执行的 Ø存储过程可以通过存储过程名称而被直接调用。   注意:同类型的触发器在表上可以有多个 触发器作用 Ø禁止无效的修改   Ø级联修改相关表格   Ø执行较为复杂的约束操作 触发器类型   Øinsert 触发器   Ø     delete 触发器   Ø     update 解发器   创建格式 create trigger 触发器名 on 表名|视图名    [for|after|instead of]                   [delete][,insert][,update]  as       sql语句组    例1:设计一个应用,每增加一个新学生,则打印消息“insert successful”   Create Trigger InsertTrigger on stuInfo for insert as    print 'insert successful'   ......

阅读全文(1559) | 评论:0

子查询(2008-11-03 10:58:00)

摘要:  nIN引入的子查询 操作符IN,用来确定某个列值是否在内部查询的结果集中。 例:查询波士顿的供应商生产的产品名称和单    价。       首先,要知道哪些供应商是波士顿的,然后,通过波士顿的供应商编号查出相关的产品名称和单价。   SELECT ProductName , Unitprice FROM Products WHERE SupplierID IN (SELECT SupplierID FROM Suppliers WHERE City = 'Boston')   在操作符“IN”前可以加“NOT”取内部查询中相反的结果。 例:查询不是波士顿的供应商生产的产品信息。 SELECT ProductName , Unitprice FROM Products WHERE SupplierID NOT IN (SELECT SupplierID FROM Suppliers WHERE City = 'Boston')   nEXISTS引入的子查询 EXISTS是测试子查询是否有数据行返回,如果有则返回TRUE,否则返回FALSE。NOT EXISTS 则相反,当结果表为空时,才返回TRUE。 例:查询波士顿的供应商生产的产品名   称和单价。   SELECT ProductName , Unitprice FROM Products WHERE EXISTS (SELECT SupplierID FROM Suppliers WHERE Products.SupplierID =Suppliers.SupplierID AND City = 'Boston') 例:使用“NOT EXISTS”查询不是波士顿的供应      商生产的产品名称和单价。 SELECT ProductName , Unitprice FROM Products WHERE NOT EXISTS (SELECT SupplierID FROM Suppliers WHERE Products.SupplierID =Suppliers.SupplierID AND City =......

阅读全文(1480) | 评论:0

.net_Ajax聊天室项目系列解读(Defalut.aspx.cs)(2008-10-31 17:31:00)

摘要:using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
public partial class _Default : System.Web.UI.Page
{
    //获取当前在线用户的列表
    protected void Timer2_Tick(object sender, EventArgs e)
    {
        StringBuilder sb = new StringBuilder("<ul>", 300);//输出的字符串对象
        foreach (ChatUser user in Room.Instance.GetAllUsers())//遍历每个在线用户,构造出字符串
        {
            string temp = Server.HtmlEncode(user.Name);//编码
            sb.Append("<li><a......

阅读全文(2129) | 评论:0

.net_Ajax聊天室项目系列解读(Defalut.aspx)(2008-10-31 17:29:00)

摘要:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Ajax 聊天室</title>
    <link href="./js/chat.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <div>
            <h3>
                Ajax 聊天室演示</h3>
&n......

阅读全文(2033) | 评论:0

.net_Ajax聊天室项目系列解读(web.config)(2008-10-31 17:29:00)

摘要:<?xml version="1.0"?>
<configuration>
 <configSections>
  <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
   <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
    <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
    <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neu......

阅读全文(3871) | 评论:0

.net_Ajax聊天室项目系列解读(msg.cs)(2008-10-31 17:27:00)

摘要:using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
//聊天消息类
public class Msg
{
    private string _UserName = "系统";//消息发送者
    private string _OtherName = "所有人";//消息接收者
    private string _Message;//消息
    private DateTime _DateTime;//发送时间
    private string _Img = "";//表情图片
    private string _IsBold = "0";//是否黑体(斜体)
    private string _Color = null;//消息的颜色
   
    public DateTime DateTime//消息发送时间
    {
        get
        {
            return this._DateTime;
        }
    }
    public string UserName//消息发送者
   ......

阅读全文(1737) | 评论:0

.net_Ajax聊天室项目系列解读(User.cs)(2008-10-31 17:27:00)

摘要:using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
//聊天用户类
public class ChatUser
{
    private string _Name;//账号
    private string _Password;//密码
    private DateTime lastUpdated;//上次更新时间
    public ChatUser(string name, string password)
    {
        this._Name = name;
        this._Password = password;
        this.lastUpdated = DateTime.Now;
    }
    public string Name//账号
    {
        get
        {
            return this._Name;
        }
   ......

阅读全文(1803) | 评论:0