我有一个名为“News-News”的表格,可以在其中保存我网站的新闻。我使用“int”和“nvarchar(3999)”数据类型向该表添加了新的四列。问题出在这里:我可以将数据类型更改为“nvarchar(50)”并且可以成功保存,但是当我想再次将其更改为“nvarchar(3999)”时,它返回此错误:
'News-News' table- Unable to modify table. Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
问题还没有结束!我可以将数据插入此表,但我无法删除和更新它。这是错误:
string or binary data would be truncated
The data in row 1 was not committed
.Net SqlClient Data Provider
这是表格完整代码:
/****** Object: Table [dbo].[News-News] ******/
[ID] [int] IDENTITY(1,1) NOT NULL,
[Title] [nvarchar](399) NOT NULL,
[Abstract] [ntext] NULL,
[Value] [ntext] NULL,
[UserID] [int] NOT NULL,
[GroupID] [int] NOT NULL,
[Date] [nvarchar](3999) NOT NULL,
[Views] [int] NULL,
[Hates] [int] NULL,
[Likes] [int] NULL,
[Source] [nvarchar](3999) NULL,
CONSTRAINT [PK_News-News] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
Hates 、 Likes 、 Views 和 Source 列是新的。
我在 MS SQL Management Studio 和我的 ASP.NET 网站上遇到了这个问题。两者都有相同的超时问题。
更新
我有一个名为“NewsSqlDataSource”的 SqlDataSource,其中包含三个查询“插入”、“更新”和“删除”。我NewsSqlDataSource.Insert();
用于插入、 NewsSqlDataSource.Update();
编辑和NewsSqlDataSource.Delete();
删除。这里我有查询代码:
- 用于插入
INSERT INTO [News-News] (Title, Abstract, Value, UserID, GroupID, Date, Source) VALUES (@title, @Abstract, @Value, @UserID, @GroupID, @Date, @Source)
- 用于更新
UPDATE [News-News] SET Title = @Title, Abstract = @Abstract, Value = @Value, Date = @Date, GroupID = @GroupID, Source = @Source WHERE (ID = @ID)
- 用于删除
DELETE FROM [News-News] WHERE (ID = @ID)