精妙 SQL语句

评分 4.00, 满分 5星 1 票 No comments
--说明:复制表(只复制结构,源表名:a 新表名:b) 
select * into b from a where 1<>1 

--说明:拷贝表(拷贝数据,源表名:a 目标表名:b) 
insert into b(a, b, c) select d,e,f from b; 

--说明:显示文章、提交人和最后回复时间 
select a.title
			,a.username
			,b.adddate 
from table a
,(select max(adddate) adddate from table where table.title=a.title) b 

--说明:外连接查询(表名1:a 表名2:b) 
select a.a, a.b, a.c, b.c, b.d, b.f 
from a 
LEFT OUT JOIN b 
	ON a.a = b.c 

--说明:日程安排提前五分钟提醒 
select * from 日程安排 where datediff('minute',f开始时间,getdate())>5 

--说明:两张关联表,删除主表中已经在副表中没有的信息 
delete from info where not exists ( select * from infobz where info.infid=infobz.infid ) 

好风景

评分 0.00, 满分 5星 0 票 No comments

image

rt

HP 安装Windows 2003 问题

评分 0.00, 满分 5星 0 票 No comments

在HP电脑上安装windows 2003 server / Ghost 系统时有时会遇到:
windows could not start because of a computer disk hardware configuration problem could not read from the selected boot disk check boot path and disk hardware. please check the windows documentation about hardware disk configuration  and your hardware refer once manuals for additional information.
在格式化和拷贝完安装文件后第一次重启时提示“因计算机磁盘硬件的配置问题,无法启动。不能读取所选的引导盘,请检查引导路径和磁盘硬件。请参阅文档中有关磁盘配置的信息并参阅您的硬件参考手册,以获得进一步的信息。

只要将BIOS中Power Management Setup中的 WDRT support 禁止掉,windows2003就可以正常启动了

*WDRT是watchdog resource table

断掉 指定数据库的 当前链接

评分 0.00, 满分 5星 0 票 No comments

断掉 当前链接 数据库的 链接,便于恢复数据库。

--终结 数据库连接
--2009-04-18 Edit by Xing
--断掉 当前链接 数据库的 链接,便于恢复数据库。
--

  Use   Master   
    
  Create   Table   #aa(spid   int,ecid   int,status   varchar(300),loginname   varchar(100),hostname   varchar(200),blk   int   ,dbname   varchar(30),cmd   varchar(100),request_id   int)   
  Insert   Into   #aa   Exec   sp_who   
  Declare   tt   Cursor   for   Select   spid   From   #aa   Where   spid>50   and   dbname='DATANAME'   ----dbname   是你的数据库名字   
  Open   tt   
  Declare   @ActiveUserId   Int,@KillString   Varchar(100)   
  Fetch   Next   From   tt   Into   @ActiveUserId   
  While(@@Fetch_Status=0)   
  Begin   
      Set   @KillString='Kill   '+Convert(Varchar(50),@ActiveUserId)   
      Exec(@KillString)   
      Fetch   Next   From   tt   Into   @ActiveUserId   
  End   
  Drop   Table   #aa   
  Close   tt   
  Deallocate   tt 

[原创]VB.net Group Box 窗口内 自由 拖拽

评分 0.00, 满分 5星 0 票 No comments
#Region "Group Box 拖拽"

    Dim CurrX As Integer
    Dim CurrY As Integer
    Dim MousX As Integer
    Dim MousY As Integer
    Dim MovBoll As Boolean

    '*--将 gpbMATERIAL_INFO 更换为 自己Group Box的名字
    Private Sub gpbATT_FILE_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles gpbMATERIAL_INFO.MouseDown
        MousX = e.X
        MousY = e.Y
        MovBoll = True
    End Sub

    Private Sub gpbATT_FILE_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles gpbMATERIAL_INFO.MouseMove
         If MovBoll = True Then
            CurrX = sender.Left - MousX + e.X
            CurrY = sender.Top - MousY + e.Y
            sender.Location = New System.Drawing.Point(CurrX, CurrY)
        End If
    End Sub

    Private Sub gpbATT_FILE_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles gpbMATERIAL_INFO.MouseUp
        MovBoll = False
    End Sub


#End Region

[原创]VB.net 使用XML 对 FpSpread 列宽记忆

评分 0.00, 满分 5星 0 票 1 comment
'需要引入的 命名空间
Imports System.Xml
Imports System.IO

#Region "XML 读取 写入 生成"
Private Sub createXML(ByVal xmlFileName As String)
	Try
	
		Dim writer As New Xml.XmlTextWriter(xmlFileName, System.Text.Encoding.GetEncoding("utf-8"))
		'使用自动缩进便于阅读
		writer.Formatting = Xml.Formatting.Indented
		writer.WriteRaw("<!--l version=""1.0"" encoding=""utf-8""-->")
		writer.WriteRaw("<!--   Xing   -->")
		'书写根元素()
		writer.WriteStartElement("xx")
		'关闭根元素
		writer.WriteFullEndElement()
		'将XML写入文件并关闭writer
		writer.Close()
	
	Catch ex As System.Exception
		MsgBox(ex.Message & vbCrLf & ex.StackTrace)
	End Try
End Sub

Private Sub FpSpread_Column_Size_load(ByVal FpSpread As FarPoint.Win.Spread.FpSpread)
	Dim xmlDoc As New XmlDocument
	Dim XmlFileName As String = "C:\XX\INI\FpSpread_Config.xml" '修改为实际XML路径
	Dim intCol As Integer
	
	Try
	
		If File.Exists(XmlFileName) Then
			xmlDoc.Load(XmlFileName)		
			Dim nodeList As XmlNodeList = xmlDoc.SelectSingleNode("xx").ChildNodes '获取xx节点的所有子节点
			Dim xn As XmlNode
			
			For Each xn In nodeList
				Dim xe As XmlElement = CType(xn, XmlElement)				
				If xe.GetAttribute("form") = Me.Name And xe.GetAttribute("Name") = FpSpread.Name Then				
					Dim nls As XmlNodeList = xe.ChildNodes '继续获取xe子节点的所有子节点
					Dim xn1 As XmlNode
					
					For Each xn1 In nls '遍历
						Dim xe2 As XmlElement = CType(xn1, XmlElement) '转换类型
						
						intCol = xe2.Name.Substring(1, xe2.Name.Length - 1)
						FpSpread.ActiveSheet.Columns(Val(intCol)).Width = Integer.Parse(xe2.InnerText)					
					Next xn1
				
				End If
			
			Next
		End If
		
	Catch ex As System.Exception
		File.Delete(XmlFileName)
	End Try
End Sub

Private Sub FpSpread_Column_Size_save(ByVal FpSpread As FarPoint.Win.Spread.FpSpread)
	Dim xmlDoc As New XmlDocument
	Dim XmlFileName As String = "C:\xx\INI\FpSpread_Config.xml" '修改为实际XML路径
	Dim intRecord As Integer
	
	Try
	If File.Exists(XmlFileName) = False Then
		createXML(XmlFileName)
	End If
	
	xmlDoc.Load(XmlFileName)	
	Dim nodeList As XmlNodeList = xmlDoc.SelectSingleNode("xx").ChildNodes '获取xx节点的所有子节点
	Dim xn As XmlNode
	
		For Each xn In nodeList '遍历所有子节点
			Dim xe As XmlElement = CType(xn, XmlElement) '将子节点类型转换为XmlElement类型
			If xe.GetAttribute("form") = Me.Name And xe.GetAttribute("Name") = FpSpread.Name Then '如果form属性值为“当前窗口”Name为 当前spread 那么就 清空下面的数据
			intRecord += 1
			xe.RemoveAll() '*清空数据
			
				If intRecord < 2 Then
				xe.SetAttribute("form", Me.Name)
				xe.SetAttribute("Name", FpSpread.Name)
				
				Dim child_node As XmlElement
					For i As Integer = 0 To FpSpread.ActiveSheet.Columns.Count - 1
						child_node = xmlDoc.CreateElement("C" & i)
						child_node.InnerText = FpSpread.ActiveSheet.Columns(i).Width
						xe.AppendChild(child_node)
					
					Next
				End If
			End If
		Next xn
	
	If intRecord < 1 Then
		Dim root As XmlNode = xmlDoc.SelectSingleNode("xx")
		Dim xe1 As XmlElement = xmlDoc.CreateElement("spread")
		xe1.SetAttribute("form", Me.Name)
		xe1.SetAttribute("Name", FpSpread.Name)
		
		Dim child_node As XmlElement
			For i As Integer = 0 To FpSpread.ActiveSheet.Columns.Count - 1
			child_node = xmlDoc.CreateElement("C" & i)
			child_node.InnerText = FpSpread.ActiveSheet.Columns(i).Width
			xe1.AppendChild(child_node)
	
		Next
	
		root.AppendChild(xe1) '添加到节点中
	
	End If
	
	xmlDoc.Save(XmlFileName) '保存。
	Catch ex As System.Exception
	
	End Try
	
End Sub
#End Region

#Region "Form Load"
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
	'spread load
	FpSpread_Column_Size_load(Me.spListMain)
End Sub
#End Region

#Region "form 关闭"
Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
	FpSpread_Column_Size_save(Me.spListMain)
End Sub
#End Region

生成的XML文件内如如下

<?xml version="1.0" encoding="utf-8"?>
<!--   Xing   -->
<xx>
  <spread form="FORM1" Name="spListMain">
    <C0>60</C0>
    <C1>90</C1>
    <C2>106</C2>
    <C3>60</C3>
    <C4>80</C4>
    <C5>60</C5>
    <C6>178</C6>
    <C7>60</C7>
    <C8>119</C8>
    <C9>82</C9>
    <C10>145</C10>
    <C11>88</C11>
    <C12>123</C12>
    <C13>60</C13>
  </spread>
  <spread form="FORM1" Name="spListList">
    <C0>17</C0>
    <C1>65</C1>
    <C2>65</C2>
    <C3>31</C3>
    <C4>60</C4>
    <C5>65</C5>
    <C6>118</C6>
    <C7>69</C7>
    <C8>62</C8>
    <C9>71</C9>
    <C10>34</C10>
    <C11>52</C11>
    <C12>58</C12>
    <C13>58</C13>
    <C14>59</C14>
    <C15>106</C15>
    <C16>34</C16>
    <C17>34</C17>
  </spread>
  <spread form="FORM1" Name="spList1">
    <C0>60</C0>
    <C1>60</C1>
    <C2>60</C2>
    <C3>32</C3>
    <C4>60</C4>
    <C5>71</C5>
    <C6>60</C6>
    <C7>60</C7>
    <C8>60</C8>
    <C9>60</C9>
    <C10>60</C10>
    <C11>72</C11>
    <C12>68</C12>
    <C13>70</C13>
    <C14>60</C14>
    <C15>60</C15>
    <C16>60</C16>
    <C17>60</C17>
    <C18>60</C18>
    <C19>60</C19>
    <C20>60</C20>
    <C21>60</C21>
    <C22>65</C22>
  </spread>
</xx>

VB.net 删除文件夹内所有文件

评分 0.00, 满分 5星 0 票 No comments
Imports System.IO

Public Shared Sub DeleteDir(ByVal aimPath As String)
    Try

        '判断待删除的目录是否存在,不存在则退出.    
        If (Not Directory.Exists(aimPath)) Then Exit Sub
        ' 得到源目录的文件列表,该里面是包含文件以及目录路径的一个数组    
        ' 如果你指向Delete目标文件下面的文件而不包含目录请使用下面的方法    
        ' string[] fileList = Directory.GetFiles(aimPath);    
        Dim fileList() As String = Directory.GetFileSystemEntries(aimPath)
        ' 遍历所有的文件和目录    
        For Each FileName As String In fileList
        If (Directory.Exists(FileName)) Then
        ' 先当作目录处理如果存在这个目录就递归Delete该目录下面的文件    
        DeleteDir(aimPath + Path.GetFileName(FileName))
        Else
        ' 否则直接Delete文件    
        File.Delete(aimPath + Path.GetFileName(FileName))
        End If
        Next
        '删除文件夹、不删除    
        'System.IO.Directory.Delete(aimPath, True)
        Catch ex As Exception
        MessageBox.Show(ex.ToString())
    End Try
End Sub

Windows 桌面文字背景 透明

评分 0.00, 满分 5星 0 票 No comments

打开系统属性-高级-性能-视觉效果使用了“在桌面上为图标标签使用阴影”之后标签上仍然显示桌面背景底色而非透明的问题。
值得一提的是,设定了桌面上锁定web项目或显示网页也会导致上面这个问题(确保你没启用)
其实,只要你的注册表中的下面两个键值跟 给出的数据都一样,可以确保你的桌面图标标签背景透明。
(打开注册表编辑器:开始-运行regedit )
hkey_current_user\software\microsoft\windows\currentversion\explorer\advanced 中的listviewshadow键值数据为1
该键值修改生效需重启explorer.exe —— 任务管理器中结束所有explorer进程,再新建任务explorer
hkey_current_user\software\microsoft\windows\currentversion\explorer 中的shellstate键值(双击)数据显示为该键值修改生效只需刷新桌面
两者一定要同时成立。