rmb请人解决ASP.NET程序向MSSQL数据插入中文时显示??号

btou778 2009-04-18 08:22:23
空间是国外的,本程序在国内空间调试无任务问题

注意:不是网页的页面内容显示?号,是数据库本身插入的中文显示?号

数据库脚本里已有的中文能正常写入在数据库

找了很多资料,有人说是数据库脚本问题,有的人说是ASP。NET程序问题

下面是数据脚本,高手看看,如能解决,必RMB酬谢

if exists (select * from sysobjects where id = OBJECT_ID('[AdminUser]') and OBJECTPROPERTY(id, 'IsUserTable') = 1)
DROP TABLE [AdminUser]

CREATE TABLE [AdminUser] (
[AdminId] [int] IDENTITY (1, 1) primary key NOT NULL,
[AdminUserName] [nvarchar] (255) NULL,
[AdminPwd] [nvarchar] (255) NULL)
go
INSERT [AdminUser] ([AdminUserName],[AdminPwd]) VALUES ('gameadmin','gameadmin')
INSERT [AdminUser] ([AdminUserName],[AdminPwd]) VALUES ('admin','admin')
go
if exists (select * from sysobjects where id = OBJECT_ID('[News]') and OBJECTPROPERTY(id, 'IsUserTable') = 1)
DROP TABLE [News]
go
CREATE TABLE [News] (
[NewsId] [int] IDENTITY (1, 1) primary key NOT NULL,
[NewsTitle] [nvarchar] (100) NULL,
[NewsContent] [ntext] NULL,
[NewsDate] [nvarchar] (50) NULL,
[Newstype] [int] NULL,
[Newsauthor] [nvarchar] (100) NULL,
[IsPass] [int] NULL,
[clickcount][int] NULL)
go
if exists (select * from sysobjects where id = OBJECT_ID('[NewType]') and OBJECTPROPERTY(id, 'IsUserTable') = 1)
DROP TABLE [NewType]

CREATE TABLE [NewType] (
[NewTypeId] [int] IDENTITY (1, 1) PRIMARY KEY NOT NULL,
[NewTypeName] [nchar] (10) NULL)

INSERT [NewType] ([NewTypeName]) VALUES (N'网站新闻')
INSERT [NewType] ([NewTypeName]) VALUES (N'心情故事')
INSERT [NewType] ([NewTypeName]) VALUES (N'经验心得')
go
if exists (select * from sysobjects where id = OBJECT_ID('[Photos]') and OBJECTPROPERTY(id, 'IsUserTable') = 1)
DROP TABLE [Photos]

CREATE TABLE [Photos] (
[PhotoId] [int] IDENTITY (1, 1) primary key NOT NULL,
[BackUrl] [nvarchar] (500) NULL,
[PhotoUrl] [nvarchar] (500) NULL,
[GameName] [nvarchar] (500) NULL,
[PhotoRemark] [nvarchar] (100) NULL,
[PhotoName] [nvarchar] (100) NULL,
[PhotoType] [int] NULL,
[IsPass] [int] NULL)
go
if exists (select * from sysobjects where id = OBJECT_ID('[PhotoType]') and OBJECTPROPERTY(id, 'IsUserTable') = 1)
DROP TABLE [PhotoType]

CREATE TABLE [PhotoType] (
[PhotoTypeId] [int] IDENTITY (1, 1) PRIMARY KEY NOT NULL,
[PhotoTypeName] [nvarchar] (100) NULL)

INSERT [PhotoType] ([PhotoTypeName]) VALUES (N'玩家靓照')
INSERT [PhotoType] ([PhotoTypeName]) VALUES (N'游戏截图')
INSERT [PhotoType] ([PhotoTypeName]) VALUES (N'合作专区')
INSERT [PhotoType] ([PhotoTypeName]) VALUES (N'合作媒体')
go

-- 创建默认分页存储过程
create PROCEDURE GetRecordFromPage
@tblName nvarchar(255), -- 表名
@fldName nvarchar(255), -- 字段名
@PageSize int = 10, -- 页尺寸
@PageIndex int = 1, -- 页码
@OrderType bit = 0, -- 设置排序类型, 非 0 值则降序
@strWhere nvarchar(2000) = '' -- 查询条件 (注意: 不要加 where)
AS
declare @strSQL nvarchar(4000) -- 主语句
declare @strTmp nvarchar(1000) -- 临时变量
declare @strOrder nvarchar(500) -- 排序类型

if @OrderType != 0
begin
set @strTmp = ' <(select min'
set @strOrder = ' order by [' + @fldName + '] desc'
end
else
begin
set @strTmp = '>(select max'
set @strOrder = ' order by [' + @fldName +'] asc'
end

set @strSQL = 'select top ' + str(@PageSize) + ' * from ['
+ @tblName + '] where [' + @fldName + ']' + @strTmp + '(['
+ @fldName + ']) from (select top ' + str((@PageIndex-1)*@PageSize) + ' ['
+ @fldName + '] from [' + @tblName + ']' + @strOrder + ') as tblTmp)'
+ @strOrder

if @strWhere != ''
set @strSQL = 'select top ' + str(@PageSize) + ' * from ['
+ @tblName + '] where [' + @fldName + ']' + @strTmp + '(['
+ @fldName + ']) from (select top ' + str((@PageIndex-1)*@PageSize) + ' ['
+ @fldName + '] from [' + @tblName + '] where ' + @strWhere + ' '
+ @strOrder + ') as tblTmp) and ' + @strWhere + ' ' + @strOrder

if @PageIndex = 1
begin
set @strTmp = ''
if @strWhere != ''
set @strTmp = ' where (' + @strWhere + ')'

set @strSQL = 'select top ' + str(@PageSize) + ' * from ['
+ @tblName + ']' + @strTmp + ' ' + @strOrder
end

exec (@strSQL)
go
--新闻分页
create proc newsasppage
@pageSize int,
@currPage int,
@strWhere nvarchar(100)
as
declare @strsql nvarchar(500)
if
@strWhere=''
begin
set @strsql=
'select top'+ str(@pagesize)+' * from news as n inner join newtype as nt on n.newstype=nt.newtypeid where n.newsid not in
(select top'+str(@pageSize*(@currPage-1))+' newsid from news )'
end
else
begin
set @strsql=
'select top'+ str(@pagesize)+' * from news as n inner join newtype as nt on n.newstype=nt.newtypeid where n.newsid not in
(select top'+str(@pageSize*(@currPage-1))+' newsid from news ) and' +@strWhere
end
exec(@strsql)
go
--图片分页
create proc photoasppage
@pageSize int,
@currPage int,
@strWhere nvarchar(100)
as
declare @strsql nvarchar(500)
if
@strWhere=''
begin
set @strsql=
'select top'+ str(@pagesize)+' * from photos as n inner join phototype as nt on n.phototype=nt.phototypeid where n.photoid not in
(select top'+str(@pageSize*(@currPage-1))+' photoid from photos )'
end
else
begin
set @strsql=
'select top'+ str(@pagesize)+' * from photos as n inner join phototype as nt on n.phototype=nt.phototypeid where n.photoid not in
(select top'+str(@pageSize*(@currPage-1))+' photoid from photos ) and' +@strWhere
end
exec(@strsql)


我的QQ 585846
...全文
51 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
btou778 2009-04-18
  • 打赏
  • 举报
回复
国内的空间没问题的。。。。
sayluyun 2009-04-18
  • 打赏
  • 举报
回复
国内的空间怎么样?··
btou778 2009-04-18
  • 打赏
  • 举报
回复
加个QQ吧,帮忙看看能不能解决

页面的中文是可以显示正常的
sy_binbin 2009-04-18
  • 打赏
  • 举报
回复
程序字符集的问题吧

62,268

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧