public class radNum
{

    
string codeSerial = "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,L,N,O,P,Q,R,S,T,U,V,W,X,Y,Z";//这里添加你要随机产生的字符,当然你可以加些数字机去,我在这里只产生大写和小写字母。

//以下东西很简单了,仔细看看就能明白
    public string CodeSerial
    
{
        
get return codeSerial; }
        
set { codeSerial = value; }
    }

    
public string CreateRadNum(int codeLen)
    
{
        
        
int Length = 4;
        
if (codeLen == 0)
        
{
            codeLen 
= Length;
        }


        
string[] arr = CodeSerial.Split(',');

        
string code = "";

        
int randValue = -1;

        Random rand 
= new Random(unchecked((int)DateTime.Now.Ticks));

        
for (int i = 0; i < codeLen; i++)
        
{
            randValue 
= rand.Next(0, arr.Length - 1);

            code 
+= arr[randValue];
        }


        
return code;
    }

}


///调用方法还是写上吧:
//
//            string radnum;
//            radNum rad = new radNum();
//            radnum = rad.CreateRadNum(20);//产生20个随机字符
posted @ 2008-07-26 22:16 欧拉 阅读(288) | 评论 (1)编辑
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Collections.Generic;
using System.Text;
using System.Net.Mail;

public partial class Default : System.Web.UI.Page
{
    
protected void Page_Load(object sender, EventArgs e)
    
{

    }

    
protected void Button1_Click(object sender, EventArgs e)
    
{
          sendMail(
"569868860@qq.com""这是一封测试邮件""这是一封测试邮件的正文内容");
    }

    
static bool sendMail(string to, string title, string content)
    
{
       
string strHost = "smtp.qq.com";   //STMP服务器地址
        string strAccount = "569868860";       //SMTP服务帐号
        string strPwd = "******";       //SMTP服务密码
        string strFrom = "569868860@qq.com";  //发送方邮件地址



        SmtpClient _smtpClient 
= new SmtpClient();
        _smtpClient.DeliveryMethod 
= SmtpDeliveryMethod.Network;//指定电子邮件发送方式
        _smtpClient.Host = strHost; ;//指定SMTP服务器
        _smtpClient.Credentials = new System.Net.NetworkCredential(strAccount, strPwd);//用户名和密码

        MailMessage _mailMessage 
= new MailMessage(strFrom, to);
        _mailMessage.Subject 
= title;//主题
        _mailMessage.Body = content;//内容
        _mailMessage.BodyEncoding = System.Text.Encoding.UTF8;//正文编码
        _mailMessage.IsBodyHtml = true;//设置为HTML格式
        _mailMessage.Priority = MailPriority.High;//优先级

        
try
        
{
            _smtpClient.Send(_mailMessage);
            
return true;
        }

        
catch
        
{
            
return false;
        }

    }


}

posted @ 2008-07-24 04:13 欧拉 阅读(116) | 评论 (1)编辑
 1using System;
 2using System.Collections.Generic;
 3using System.Linq;
 4using System.Text;
 5
 6
 7namespace perm
 8{
 9    class Program
10    {
11        static void permlist(int[] listdata, int k, int m)
12            {
13                if (k == m)
14                {
15                    for (int i = 0; i <= m; i++) System.Console.Write(listdata[i]);
16                    Console.WriteLine();
17                }

18                else
19                    for (int i = k; i <= m; i++)
20                    {
21                        Swap(ref listdata[k],ref listdata[i]);
22                        permlist(listdata, k + 1, m);
23                        Swap(ref listdata[k],ref listdata[i]);
24                    }

25            }

26            static void Swap(ref int a,ref int b)
27            {
28                int temp = a; a = b; b = temp;
29            }

30
31        
32        static void Main(string[] args)
33        {
34            int[] listdata = 0123456789 };
35                 
36            permlist(listdata, 03);
37
38        }

39
40    }

41}

42
posted @ 2008-07-22 02:45 欧拉 阅读(183) | 评论 (0)编辑
     摘要: 显示系统当前的时间,修改系统当前的时间1DATASSEGMENT2nowtimedb'thetimenowis:$'3modtimedb'settingthenewtime$'4hstringdb'enterthehour:$'5mstringdb'entertheminute:$'6sstringdb'enterthesecond:$'78;此处输入数据段代码9DATASENDS1011STAC... 阅读全文
posted @ 2008-06-30 18:47 欧拉 阅读(628) | 评论 (1)编辑

        从进入大学,在flouse的影响下一直对.net充满好奇,但一直在.net周围绕圈子,一直心怀暧昧,绕了接近一年的圈子,挠痒挠久了没感觉了,趁此机会,茅头直指.net

        asp到asp.net,不只是技术上转变,同样是思想上的转变,不得不佩服MS。
        
        初学,有以下问题,慢慢学习:

 1、不熟悉VS环境,对于VS生成的大量代码感到迷惑,力不从心。
 2、SQL数据库连接问题一直不能解决(不要笑我菜)。

努力......
感谢胡师兄。。。

posted @ 2008-05-05 14:17 欧拉 阅读(58) | 评论 (4)编辑