上一页 1 2 3 4 5 6 7 ··· 12 下一页

2012年8月29日

byte[]与Image Image与 byte[] 之间的转换

摘要: /// <summary>/// 将byte[]转换为Image/// </summary>/// <param name="bytes">字节数组</param>/// <returns>Image</returns>public Image ReadImage(byte[] bytes){MemoryStream ms=new MemoryStream(bytes,0,bytes.Length);BinaryFormatter bf = new BinaryFormatter();object ob 阅读全文

posted @ 2012-08-29 17:34 ewyb 阅读(499) 评论(0) 推荐(0) 编辑

2012年7月20日

解决:System.Data.SqlClient.SqlError: FILESTREAM 功能被禁用

摘要: 还原 AdventureWorks Sample DataBase 时遇到 FILESTREAM feature is disabled 错误提示.FileStream是SQL Server 2008 新添加的feature, 默认是关闭的. 如果 DB backup 文件启用了这个功能,再另外一台 Server 上还原时也需要 enable 这个feature.刚开始的时候想通过更改 SQL Server Configuration Manager 打开, 步骤如下:1> 打开 SQL Server Configuration Manager2> 找到 SQL Server Se 阅读全文

posted @ 2012-07-20 10:25 ewyb 阅读(733) 评论(0) 推荐(0) 编辑

2012年7月18日

远程报表的调用

摘要: this.reportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote;this.reportViewer1.ServerReport.ReportPath = @"/Report1";this.reportViewer1.ServerReport.ReportServerUrl = new Uri(@"http://172.20.63.12:8082/reportserver");this.reportViewer1.ServerReport.Repo 阅读全文

posted @ 2012-07-18 21:54 ewyb 阅读(332) 评论(0) 推荐(0) 编辑

2012年7月17日

在不预览的情况下打印本地报表

摘要: using System;using System.IO;using System.Data;using System.Text;using System.Drawing.Imaging;using System.Drawing.Printing;using System.Collections.Generic;using System.Windows.Forms;using Microsoft.Reporting.WinForms;public class Demo : IDisposable{ private int m_currentPageIndex; private IL... 阅读全文

posted @ 2012-07-17 09:59 ewyb 阅读(346) 评论(0) 推荐(0) 编辑

2012年7月13日

DataGridView显示行号

摘要: 可以做成扩展控件,这里是主要代码:方法一:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->privatevoiddataGridView2_RowPostPaint(objectsender,DataGridViewRowPostPaintEventArgse){using(varbrush=newSolidBrush(dataGridView2.RowHeadersDefaultCellStyle.ForeColor)){e.Graphic 阅读全文

posted @ 2012-07-13 12:27 ewyb 阅读(335) 评论(0) 推荐(0) 编辑

2012年3月14日

SQL:select case when(转)

摘要: CASE可能是SQL中被误用最多的关键字之一。虽然你可能以前用过这个关键字来创建字段,但是它还具有更多用法。例如,你可以在WHERE子句中使用CASE。 首先让我们看一下CASE的语法。在一般的SELECT中,其语法如下: SELECT<myColumnSpec>= CASE WHEN<A>THEN<somethingA> WHEN<B>THEN<somethingB> ELSE<somethingE> END 在上面的代码中需要用具体的参数代替尖括号中的内容。下面是一个简单的例子: USEpubs GO SELECT T 阅读全文

posted @ 2012-03-14 17:57 ewyb 阅读(393) 评论(0) 推荐(0) 编辑

2011年12月16日

ToString()和Convert.ToString()的用法区别

摘要: 一、一般用法说明在C#中所有继承自object的类都有tostring()方法,在没有特别声明的情况下,C#中的类都是默认继承自object,所以都有tostring()方法;而Convert.ToString(param)(其中param参数的数据类型可以是各基本数据类型,也可以是bool或object类对像;二、ToString()和Convert.ToString()的区别一般情况下,这两种方法都可以通用,但是当返回的数据类型中有可能出现null值时如果调用tostring方法了,就会返回NullReferenceException,除非你要捕捉此异常再做处理,否则在这种情况下就应考虑使 阅读全文

posted @ 2011-12-16 10:01 ewyb 阅读(419) 评论(0) 推荐(0) 编辑

2011年12月8日

用联系的观点看问题——有感DataGridView多选删除问题的解决

摘要: 低级错误!本来想实现一个简单的应用。在DataGridView控件中,加入CheckBox列实现多选删除。开始的思路,遍历CheckBox列,如果打了勾则进行删除操作: for (int i = 0; i < dataGridView1.Rows.Count; i++) { object obj = dataGridView1.Rows[i].Cells[0].Value; string select = obj == null ? "" : obj.ToString(); if (select.Trim() == "1") {//在这里从数据源中 阅读全文

posted @ 2011-12-08 11:47 ewyb 阅读(422) 评论(0) 推荐(0) 编辑

2011年12月6日

把datagridview中checkbox中的对勾的颜色弄成红色

摘要: Winform上添加一个DataGridView,后台实现代码如下: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;namespace RedDatagridViewCheckBox{ public partial class Form2 : Form { public Form2() { In 阅读全文

posted @ 2011-12-06 14:21 ewyb 阅读(1221) 评论(0) 推荐(0) 编辑

2011年11月30日

通过ADO.NET实现事务处理

摘要: 在数据库连接上创建事务处理对象,然后调用事务处理对象来提交事务或回滚事务。简单的代码:1privatevoidbutton1_Click(objectsender,System.EventArgse)2{3SqlConnectionconn=newSqlConnection("DataSource=192.168.2.200;uid=sa;password=;database=HaierHR");4conn.Open();5//启用事务6SqlTransactiontran=conn.BeginTransaction();7SqlCommandcmd=newSqlComma 阅读全文

posted @ 2011-11-30 10:56 ewyb 阅读(227) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 ··· 12 下一页

导航