/// <summary>
/// 返回所有表
/// </summary>
/// <returns></returns>
public static DataTable GetAllTables()
{
DataTable dt = new DataTable(); try
{
Con.Open();
dt = Con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,new object[]{null,null,null,"Table"});
}
catch(Exception ex)
{
throw ex;
}
finally
{
Con.Close();
} return dt;
} /// <summary>
/// 返回指定表的结构
/// </summary>
/// <param name="varTableName"></param>
/// <returns></returns>
public static DataTable GetTheTable(string varTableName)
{
DataTable dt = new DataTable(); DataSet ds = new DataSet(); OleDbDataAdapter Odb = new OleDbDataAdapter("select * from " + varTableName,Con);
try
{
Con.Open();
Odb.FillSchema(ds,SchemaType.Source,varTableName);
}
catch(Exception ex)
{
throw ex;
}
finally
{
Con.Close();
}
return ds.Tables[varTableName];
}
/// 返回所有表
/// </summary>
/// <returns></returns>
public static DataTable GetAllTables()
{
DataTable dt = new DataTable(); try
{
Con.Open();
dt = Con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,new object[]{null,null,null,"Table"});
}
catch(Exception ex)
{
throw ex;
}
finally
{
Con.Close();
} return dt;
} /// <summary>
/// 返回指定表的结构
/// </summary>
/// <param name="varTableName"></param>
/// <returns></returns>
public static DataTable GetTheTable(string varTableName)
{
DataTable dt = new DataTable(); DataSet ds = new DataSet(); OleDbDataAdapter Odb = new OleDbDataAdapter("select * from " + varTableName,Con);
try
{
Con.Open();
Odb.FillSchema(ds,SchemaType.Source,varTableName);
}
catch(Exception ex)
{
throw ex;
}
finally
{
Con.Close();
}
return ds.Tables[varTableName];
}
解决方案 »
- 请问:如何配置smtp服务器,才能收到用户使用PasswordRecovery控件找回密码的邮件?密码由哈希加密。
- CSV文件内容中有逗号,用Split的问题
- webservice 客户端发现响应内容类型为“text/html; charset=utf-8”,但应为“text/xml”。
- lovingkiss进
- 简单问题,请问这个xml XPath 寻找路径怎么写??内有xml的具体表示文档。
- 角色 权限管理中,“组”是什么概念帮忙讲解一下
- DataGridView中图片闪动的问题
- 我想做个工厂管理软件,有个不明白的地方想问下.
- datagrid双击双取值问题。
- 拷贝一个文件,同时显示拷贝进度,是不是要用到多线程??
- 请教如何用C#创建Windows服务程序
- 请高手推荐DirectDraw的学习资料。
SqlConnection conn = new SqlConnection(dbConnectionString);
SqlCommand comm = new SqlCommand("sp_columns",conn);
comm.CommandType = CommandType.StoredProcedure;
//tblName:要查看的表名
comm.Parameters.Add("@table_name",SqlDbType.NVarChar).Value = tblName;
SqlDataAdapter dap = new SqlDataAdapter(comm);
dap.Fill(ds,"columnInfo");
DataTable dt = ds.Tables["columnInfo"];
//在dt中查看这些信息就可以了
我在办公室有一个这样的存储过程。
可惜这台微机没有 数据库。