易截截图软件、单文件、免安装、纯绿色、仅160KB

c# 将枚举作为键值的形式存储

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace 将枚举作为键值的形式存储
{
    enum Myenum
    {
       First=3,
       Second,
       Third
    }
    class Program
    {
        static void Main(string[] args)
        {
            //用hashtable可以实现吗? NameValueCollection可以实现吗?
            Dictionary<string, int> dictionary = new Dictionary<string, int>();
            string [] enumArray=Enum.GetNames(typeof(Myenum));
            for (int i = 0; i < enumArray.Length; i++)
            {
                dictionary.Add(enumArray[i],(int) Enum.Parse(typeof(Myenum), enumArray[i]));
            }
            Console.WriteLine(dictionary["First"]);
            Console.WriteLine(dictionary["Second"]);
            Console.WriteLine(dictionary["Third"]);
            Console.Read();
         
        }
    }
}


相关文档:

C#中调用mysql存储过程出现的问题

在root账号中,可以正常调用存储过程.
换到common_user账号时,同一存储过程名调用出现问题.
追踪调试时出现:
SELECT command denied to user 'common_user'@'localhost' for table 'proc'
搜索解决方案:
MySqlConnection myconnection = new MySqlConnection("server=localhost;user id=common_user; password=***;dat ......

C#将空值传入到Oracle字段类型为Datatime的字段

今天做项目的时候,将null传入Oracle的表中,就是不成功
经过尝试得出了两个解决方案:
1.传入OracleDateTime.NULL
2.Nullable<DateTime> optime = DBNull.Value; 传入optime(开始网上找的答案是Nullable<DateTime> optime = null发现还是会报错) ......

asp.net c# 数据库备份

protected void btnsearch_ServerClick(object sender, EventArgs e)
    {
        string lujing=this.Text2.Value.ToString().Trim();
        string shujuku = this.jine.Value;
      &nbs ......

c# 连接MySql数据库的两种方法

1、用MySQLDriverCS连接MySQL数据库
先下载和安装MySQLDriverCS,地
址:
http://sourceforge.net/projects/mysqldrivercs/
在安装文件夹下面找到
MySQLDriver.dll
,然后将
MySQLDriver.dll
添加引用到项目中
注:我下载的是版本是

MySQLDriverCS-n-EasyQueryTools-4.0.1-DotNet2.0.exe
 
using

S ......

C# access日期查询加#

C# access日期查询加#
if (((string)((ComboBoxItem)cmbField.SelectedItem).Value).Equals("System.DateTime"))
{
                    //判断日期的;
        & ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号