- 博客(14)
- 资源 (8)
- 收藏
- 关注

原创 解决:dataGridView列不能自适应宽度问题
用过dataGridView的人都知道,如果你在后台绑定数据的时候是动态绑定的,列的标题是代码指定,比如select name as 名字,这样如果名字很长,dataGridView是不会自适应宽度的,我也被困扰了很久,网上都说AutoSizeColumnsMode设置成Fill什么什么的,我挨个试过都不行,好多人试过也不行,不知道原因是什么。我找到一个解决办法,本人试过保
2013-08-25 16:19:03
3196

原创 解决Response.Redirect和 Response.Write不能同时使用
Response.Write是把內容输出到前台,但Response.redirect是在后台跳转,所以一起用的時候,看不到Response.Write的效果,而直接跳转了。 解决办法: Response.Write(" alert( '提交成功,感谢您的意见和建议,我们表示感谢! ');window.location.href= 'Default.aspx '
2013-08-06 09:04:44
1806

原创 c#报表控件Chart实例用法
SqlConnection sqlCon = new SqlConnection(); sqlCon.ConnectionString = "server=172.11.29.111;uid=sa;pwd=sa;database=Transport"; sqlCon.Open(); string sqlStr = "select year(Sm
2013-04-10 10:57:24
3614

原创 将datagridview内容直接更新到ACCESS数据库中
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Data.OleDb;na
2013-04-09 16:42:04
2696
转载 net 弹出消息框后导致页面样式变乱解决方法
点击按钮,执行提交操作,弹出消息框后,页面的样式变乱,解决方法: 首先,确定使用的css样式正确,页面中的宽高值保持规范统一; 然后,弹出框避免使用Response.Write(),如下所示复制代码 代码如下:Response.Write(""); Response.Write("window.alert('"); Response.Write("计划添加失败!");
2014-05-30 16:28:38
743
原创 c# datatable批量插入数据库,服务器上的数据库同步,不用写sql语句,简单迅速
这是我自己查了很多资料,然后写了一个程序,测试通过meiw
2014-05-07 11:08:19
2461
转载 c#截取数组
以下实现的是c#截取数组a中第三位到第八位的数据void Main(){ byte[] a = new byte[] { 12, 32, 34, 43, 21, 23, 45, 56, 67, 78, 89, 96, 54, 32, 23, 45, 23 }; byte[] newA= a.Skip(2).Take(5).ToArray();
2014-03-25 14:27:30
19687
转载 VS2008:无法连接到ASP.NET Development server的解决办法
问题描述:启动vs2008 调试网站时,提示“无法连接到ASP.NET Development server”,无法启动调试,而其他网站则可以正常调试解决办法:这是因为该网站启动ASP.NET Development server时使用的端口被占用而导致的。具体的解决办法:1、在“解决方案资源管理器”中选中网站项目名称,然后切换到“属性”窗口 2、在“属性”窗口中,首
2013-09-09 10:48:09
1108
原创 c#获取本机所有ip
private void button1_Click(object sender, EventArgs e) { string name = System.Net.Dns.GetHostName(); IPAddress[] ipAddr = System.Net.Dns.Resolve(name).AddressList;
2013-05-22 11:11:40
632
原创 c# DataTable重新调整成新DataTable,然后动态显示在HTML Table中
本人不是高手,下面是我做项目的时候写的代码,放在博客里面做个保存,看看是否有幸能给其他朋友提供参考。int sumDt = 0; //获取报警类型对应的内容 string alarmSql = "select Alarmcontent from AlarmType where EqName='海' "; DataTable ala
2013-04-23 15:51:43
1892
原创 C#使用socket发送和接受数据
端口号和ip地址自己改一下 using System.Net; using System.Net.Sockets; static void Main(string[] args)//服务器段 { int port = 2000; string host = "127.0.0.1"; /**/ ///创建终结点(EndPoint) IPAddress ip = I
2013-04-09 16:43:21
2667
转载 C# TextBox中只能输入数字的几种常用方法
TextBox中只能输入数字的几种常用方法(C#)经过自己的项目检验,最简单的是方法三,一句话就可以。 方法一:private void tBox_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 0x20) e.KeyChar = (char)0; //禁止
2013-04-02 14:12:59
1180
原创 c#生成XML字符串,中间过程不生成本地文件,返回字符串。
private void button1_Click(object sender, EventArgs e) { // Create the file and writer. StringWriter sw = new StringWriter(); XmlTextWriter tw = new Xml
2013-03-23 11:06:57
820
原创 http错误 500.19 无法访问请求的页面
HTTP 错误 500.19 - Internal Server Error无法访问请求的页面,因为该页的相关配置数据无效。详细错误信息模块 IIS Web Core 通知 BeginRequest 处理程序 尚未确定 错误代码 0x80070005 配置错误 由于权限不足而无法读取配置文件解决办法:一:文件夹(不是iis上操作)右键属性二:点击安全——
2013-03-16 09:43:59
919
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人