rmb请人解决ASP.NET程序向MSSQL数据插入中文时显示??号
空间是国外的,本程序在国内空间调试无任务问题注意:不是网页的页面内容显示?号,是数据库本身插入的中文显示?号
数据库脚本里已有的中文能正常写入在数据库
找了很多资料,有人说是数据库脚本问题,有的人说是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 --------------------编程问答-------------------- 程序字符集的问题吧 --------------------编程问答-------------------- 加个QQ吧,帮忙看看能不能解决
页面的中文是可以显示正常的 --------------------编程问答-------------------- 国内的空间怎么样?·· --------------------编程问答-------------------- 国内的空间没问题的。。。。
补充:.NET技术 , ASP.NET