C#中使用DataTable显示Access数据库中文件列表
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
this.comboBox2.Items.Clear();
switch(this.comboBox1.SelectedIndex)
{
case 0:
try
{
OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;User ID=admin;Data Source=C:\tmpAccess\DataBase1.mdb");
conn.Open();
if(conn.State == System.Data.ConnectionState.Open){
Console.WriteLine("Success");
}
DataTable test = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new Object[] { null, null, null, "Table" });
this.dataGridView1.DataSource =test;
int tableIndex = test.Columns.IndexOf("TABLE_NAME");
foreach (DataRow row in test.Rows)
comboBox2.Items.Add(row[tableIndex].ToString());
&nb
相关文档:
用Cdbl()试试
CDbl(str) --> 双精度
CInt(str) --> 整型
CLng(str) --> 长整型
CSng(str) --> 单精度
CDate(str) --> 日期型 ......
无论在cmpp或sgip中,都会遇到短信编码格式转换的问题。
因为现在短信编码常用的格式有三种:0:ASCII串,8:UCS2编码,15:含GB汉字。在发送或接收短信时,都会用到相应的编码转换。如以下代码:
public static String Decode(Byte[] buf, int StartIndex, int Length, CODING Coding)
{
......
/// <summary>
/// 方法一:通过使用 new 运算符创建对象
/// </summary>
/// <param name="strSource">需要加密的明文</param>
/// <returns>返回16位加密结果,该结果取32位加密结果的第9位到25位</returns>
public string Get_MD5_Method1(strin ......
1 防止sql注入式攻击(可用于UI层控制) #region 防止sql注入式攻击(可用于UI层控制)
2
3 /**/ ///
4 /// 判断字符串中是否有SQL攻击代码
5 ///
6 /// 传入用户提交数据
7 /// ......
号称xmlhelper的一个类
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml;
namespace WebApplication2
{
/// <summary>
/// XMLHelper XML文档操作管理器
/// </summary>
public class XMLHelper
{
public X ......