呵呵,今天和往常一样从SQLServer2005中编写表脚本为SELECT语句,然后拷贝到记事本给头尾加上一些字符串必备的语句,结果类似:
1 private const string SQL_SELECT_FILE_BY_BLOGID = " SELECT [ID] "
2 + " ,[BlogID] "
3 + " ,[FileName] "
4 + " ,[FileSize] "
5 + " ,[FileType] "
6 + " ,[SavePath] "
7 + " ,[UploadDateTime] "
8 + " ,[DownloadTimes] "
9 + " ,[DirectoryID] "
10 + " FROM [WebAppBlog].[dbo].[File] "
11 + " WHERE [BlogID]=@BlogID "
12 + " ORDER BY [UploadDateTime] ";
运行时就出错了,于是断点将它们拷贝到记事本中如:2 + " ,[BlogID] "
3 + " ,[FileName] "
4 + " ,[FileSize] "
5 + " ,[FileType] "
6 + " ,[SavePath] "
7 + " ,[UploadDateTime] "
8 + " ,[DownloadTimes] "
9 + " ,[DirectoryID] "
10 + " FROM [WebAppBlog].[dbo].[File] "
11 + " WHERE [BlogID]=@BlogID "
12 + " ORDER BY [UploadDateTime] ";
" SELECT [ID] ,[BlogID] ,[FileName] ,[FileSize] ,[FileType] ,[SavePath] ,[UploadDateTime] ,[DownloadTimes] ,[DirectoryID] FROM [WebAppBlog].[dbo].[File] WHERE [BlogID]=@BlogID ORDER BY [UploadDateTime] "
怎么看都不觉得有问题,@BlogID改成0到查询分析器中执行,居然有' '的问题,不解!还,只好一块一块地排查,结果发现了这个神奇的位置,无语了.删除蓝色部分后就没有问题了,]符号也变小了.~
其实问题的关键不是SQLServer也不是记事本,而是VS,以前用智能ABC的时候到VS中的时候都会自动切换成全角,现在换成Goolge拼音,结果还是没有解决这个问题,期待啊~不爽死,还好这个问题解决了.