当我们直接用
select top 10 [ID] ,Identity(int,1,1) as rowIndex,Title,hits into #tmp from _Table
select * from #tmp
drop table #tmp
时,会报错:无法使用 SELECT INTO 语句向表 #tmp 中添加标识列 ID.因为原来的表_Table中已经存在标识列ID.
如果用
set nocount on
select top 10 [ID] ,Identity(int,1,1) as rowIndex,Title,hits into #tmp from(Select TOP 100 Percent * from _Table
order by hits desc) b
select * from #tmp
drop table #tmp
是却不会报错,这个我也弄不清楚.为是什么?
posted @
2008-09-01 02:55 hambywu 阅读(55) |
评论 (0) |
编辑
摘要: 1window.onerror=ScriptErrorReport;2//window.onerror=ScriptErrorKill;34//**脚本错误报告**//5functionScriptErrorReport(msg,surl,lineno)6{7varstrMsg=("抱歉,网页在运行过程中出现脚本错误!\n"8+"\n错误信息:"+msg9+"\n所在行:"+lineno10+"\...
阅读全文
posted @
2008-05-22 16:24 hambywu 阅读(26) |
评论 (0) |
编辑
Dim vEncoding As Encoding = Encoding.ASCII
Dim S = "211"
Dim vBuffer() As Byte = vEncoding.GetBytes(S)
Dim vBuilder As StringBuilder
vBuilder = New StringBuilder(S.ToString.Length * 2)
For i As Integer = 0 To vBuffer.Length - 1
vBuilder.Append(vBuffer(i).ToString("x2"))
Next
MsgBox(vBuilder.ToString())
得到结果是:323131
从16进制ASCII到字符则只需
dim s as integer=&H46
msgbox(chr(s))
得到的结果是:F
posted @
2008-04-02 10:35 hambywu 阅读(113) |
评论 (0) |
编辑
Dim con As SqlConnection = new SqlConnection("连接字符串")
Dim com As New SqlCommand
Dim dr As SqlDataReader
Dim fst As FileStream
Dim bwr As BinaryWriter
Dim numbyte As Long ‘用来记录word文件的大小


com.Connection = con
com.CommandText = "设置选择语句"
Try
con.Open()
dr = com.ExecuteReader(CommandBehavior.SequentialAccess)
Catch ex As Exception
MsgBox(ex.Message)
End Try

If dr.Read Then

‘取得WORD的大小
numbyte = dr.GetBytes(0, 0, Nothing, 0, Integer.MaxValue)

’创建文件流来将从数据库读取的WORD保存到当地磁盘
fst = New FileStream("保存的路径和名称.doc", FileMode.CreateNew, FileAccess.Write)
bwr = New BinaryWriter(fst)

Dim arr(numbyte) As Byte
将DATAREAD中的WORD放入数组中
dr.GetBytes(0, 0, arr, 0, CInt(numbyte))
bwr.Write(arr)
bwr.Flush()
bwr.Close()
fst.Close()

End If

con.Close()

Process.Start("winword", "保存的路径名称.doc")


有缺点,如果要对文档修改,要注意更新数据库,
还要将保存的WORD文件删除掉,防止再操作有文件重名的错误!
若同时打开多个WORD保存的名称可能要注意不要重复。
posted @
2008-03-26 13:35 hambywu 阅读(34) |
评论 (0) |
编辑