把生成的文件放进SqlServer里面去运行结果出现中文乱码。
按照网上教的方法试了还不不行 
该怎么办啊

解决方案 »

  1.   

    中文在数据库中变成@safename了
      

  2.   

    确认Enable unicode support
    ResponseEncoding="UTF-8" 
      

  3.   

    回复3楼确认了  出现乱码不是????
    而是在SqlServer里面执行 中文生成了@safename
      

  4.   

    参考FortuneBase
    中FortuneLibrary中对应CodeSmith模板中的代码参考www.cnblogs.com/mail-ricklee
      

  5.   

    不行啊 难到没高手了吗 跟着视频做  private string GetName(SchemaObjectBase obj, ReturnFields nameType)
    {
                return obj.Name;
    // without an object instance, this is all useless
    if (obj == null)
    throw new ArgumentNullException("obj");

    // get the name
    if (obj is TableSchema)
    return GetAliasName(((TableSchema)obj).Owner, obj.Name, null, nameType);

    else if (obj is ViewSchema)
    return GetAliasName(((ViewSchema)obj).Owner, obj.Name, null, nameType);

    else if (obj is ColumnSchema && nameType != ReturnFields.CSType)
    {
    return GetAliasName(((ColumnSchema)obj).Table.Owner, ((ColumnSchema)obj).Table.Name, obj.Name, nameType);
    }
    else if (obj is ViewColumnSchema && nameType != ReturnFields.CSType)
    return GetAliasName(((ViewColumnSchema)obj).View.Owner, ((ViewColumnSchema)obj).View.Name, obj.Name, nameType);

    else if (obj is ColumnSchema && nameType == ReturnFields.CSType)
    {
    string aliasType = GetAliasName(((ColumnSchema)obj).Table.Owner, ((ColumnSchema)obj).Table.Name, obj.Name, nameType);
    if (string.IsNullOrEmpty(aliasType))
    return ((ColumnSchema)obj).DataType.ToString(); // SystemType or NativeType ?
    else
    return aliasType;
    }

    else if (obj is ViewColumnSchema && nameType == ReturnFields.CSType)
    {
    string aliasType = GetAliasName(((ViewColumnSchema)obj).View.Owner, ((ViewColumnSchema)obj).View.Name, obj.Name, nameType);
    if (string.IsNullOrEmpty(aliasType))
    return ((ViewColumnSchema)obj).DataType.ToString(); // SystemType or NativeType ?
    else
    return aliasType;
    }

    else
    throw new ArgumentException("obj");
    }在里面添加 return obj.Name; 这个 还是不行啊  急死了
      

  6.   

    在SqlServer里面变成这样
    SELECT
    [鑿滃崟椤笽D],
    [涓婄骇鑿滃崟椤笽D],
    [鍚嶇О],
    [鎻忚堪],
    [URL],
    [鎺掑簭],
    [鍥炬爣URL]
    FROM
    [dbo].[鑿滃崟椤筣
      

  7.   

      对啊 请问怎么解决啊 加个return obj.Name;还是不行