获取数据库中指定类型的数据库名称
时间:2021-07-01 10:21:17
帮助过:5人阅读
<summary>
/// 获取数据库名称
/// </summary>
/// <param name="Account">帐套号</param>
/// <returns></returns>
public static string GetDBName(
string Account)
{
StringBuilder strSql =
new StringBuilder();
strSql.Append(" select name from master..sysdatabases where name like‘%UFDATA_%‘ ");
DataSet ds =
DbHelperSQL.Query(strSql.ToString());
int count = ds.Tables[
0].Rows.Count;
string DbName =
string.Empty;
if (count >
0)
{
for (
int i =
0; i < count; i++
)
{
DbName = ds.Tables[
0].Rows[i][
"name"].ToString();
string TempDbName = DbName.Substring(
7,
3);
if (Account ==
TempDbName)
{
return DbName;
}
}
}
return DbName;
}
获取数据库中指定类型的数据库名称
标签: