ITeye博客

2012 年文章归档

共 13 篇文章

C#获取本地IP

/// <summary> /// 获取本地Ip /// </summary> private string GetLocalIP() { IPHostEntry ipHostEntry = Dns.GetHostEntry(Dns.GetHostName()); if (ipHostEntry.AddressList.Length > 0) { foreach (IPAddress ipAddress in ipHostEntry.AddressList) { if (ipAddress.AddressFamily == AddressFamily.InterNetwork) { retu…

2012-06-06 14:39 · C#

列出备份文件中的逻辑文件名

restore filelistonly from disk='c:\xx.bak'

2012-05-14 12:40 · SQL

只能启动单个程序

bool ret; System.Threading.Mutex m = new System.Threading.Mutex(true, Application.ProductName, out ret); if (ret) { System.Windows.Forms.Application.EnableVisualStyles(); //这两行实现 XP 可视风格 System.Windows.Forms.Application.DoEvents(); ConfigurationManager.RefreshSection("appSettings"); string storeId …

2012-05-04 12:51 · C#

.Net控件命名规范

<!--------------A-----------------> AdRotator ar <!--------------B-----------------> Button btn <!--------------C-----------------> Calender cal CheckBox chk CheckBoxList chklst Column (DataGridView的) col ColumnHeader (ListView 的) ch Combobox cbo CompareValidator cv CrystalReportViewer rptvew <!---…

2012-04-25 14:45 · C#

DataGridView绑定数据时,时间格式显示不全的问题

DataGridView绑定数据时,时间格式显示问题 今天做程序的时候,遇到了这样的问题,数据库里面是 2011-09-26 18:48:41.390 可是绑定后却显示为 2011-09-26 18:48 解决办法: DataGridView.Columns["列名"].DefaultCellStyle.Format = "yyyy-MM-dd HH:mm:ss.fff";

2012-04-25 13:54 · C#

把Dgv的颜色改回默认颜色

dgv.Rows[i].DefaultCellStyle.BackColor = dgv.RowsDefaultCellStyle.BackColor;

2012-04-25 13:35 · C#

Winform 去掉 最大化 最小化 关闭按钮 保留左侧图片

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Drawing.Drawing2D; using System.Runtime.InteropServices; namespace WinDemo { public partial class Form…

2012-04-23 17:02 · C#

禁用窗体的关闭按钮

[DllImport("USER32.DLL")] public static extern int GetSystemMenu(int hwnd, int bRevert); [DllImport("USER32.DLL")] public static extern int RemoveMenu(int hMenu, int nPosition, int wFlags); /// <summary> /// 返回值,非零表示成功,零表示失败。 /// </summary> /// <param name="iHwnd">窗口的句柄</param> /// <returns>是否成功</r…

2012-04-23 16:58 · C#

查看sql死锁

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_who_lock]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[sp_who_lock] GO use master go create procedure sp_who_lock as begin declare @spid int,@bl int, @intTransactionCountOnEntry int, @intRowcount int, @i…

2012-04-09 14:44 · SQL

SQL SERVER系统控制台启动出错解决方案

关于“MMC不能打开文件C:\Program Files\Microsoft SQL Server\80\Tools\Binn\SQL Server Enterprise Manager.MSC可能是由于文件不存在,不是一个MMC控制台,或者用后来的MMC版本创建。也可能你没有访问此文件的足够权限 ” 运行mmc,控制台--添加/删除管理单元--添加--找到Microsoft SQL 企业管理器--添加--关闭--确定 回到控制台--选项--控制台模式选择"用户模式完全访问"--将下面的选择全部取消 控制台--另存为--存储为:C:\Program Files\Microsoft SQL S…

2012-03-29 15:58 · SQL

判断表是否被改变过

--判断表是否被更改 select checksum_agg(binary_checksum(*)) from dbo.PrintLog --判断表中每行是否被修改 select binary_checksum(*) from dbo.PrintLog

2012-03-15 10:20 · SQL

c#中用声音提示报警

using System; using System.Runtime.InteropServices; 调用 Interaction.Beep(); **使用MessageBeep(unit uType):**需添加 using System.Runtime.InteropServices; public const int MB_ICONEXCLAMATION = 48; [DllImport("user32.dll")] public static extern bool MessageBeep(uint uType); MessageBeep( MB_ICONEXCLAMATION )…

2012-03-14 09:51 · C#

WinForm 查看控制台输出

/// <summary> /// 创建控制台窗口 /// </summary> /// <returns></returns> [DllImport("kernel32.dll")] public static extern bool AllocConsole(); /// <summary> /// 释放控制台窗口 /// </summary> /// <returns></returns> [DllImport("kernel32.dll")] public static extern bool FreeConsole();

2012-02-15 10:39 · C#