03 2008 档案
截断表内容 和 删除表
摘要:截断表 将ID重设为1开始truncate TABLE tbl_GdsSearchQ删除表DROP TABLE tbl_Name有外建约束 不能执行 那怕 没有数据 阅读全文
posted @ 2008-03-29 12:26 阿春 阅读(732) 评论(0) 推荐(0)
利用.NET2.0自带的数据库访问工厂写的数据库访问基类
摘要:using System;using System.Collections.Generic;using System.Text;using System.Data.Common;using System.Configuration;using System.Data;namespace DAL{ public class Database { #region 字段 private const string defaultConnectionConfigKey ="default"; /// <summary> /// 数据连接字符串 /// </summa 阅读全文
posted @ 2008-03-27 18:14 阿春 阅读(510) 评论(0) 推荐(0)
sql 语句 :取总数
摘要:select count(*) from house_data 阅读全文
posted @ 2008-03-27 09:26 阿春 阅读(293) 评论(0) 推荐(0)
下载指定URL的HTML代码
摘要:WebClient client = new WebClient(); string html = ""; try { client.Encoding = DefaultEncoding; html = client.DownloadString(Url); ... 阅读全文
posted @ 2008-03-23 20:47 阿春 阅读(302) 评论(0) 推荐(0)
工厂模式的数据库连接
摘要:/// 数据连接字符串 /// private static string connectionString; /// /// 数据库 驱动 提供者 /// private static string providerName; /// /// 数据库 驱动 提... 阅读全文
posted @ 2008-03-18 17:14 阿春 阅读(257) 评论(0) 推荐(0)
执行查询语句
摘要:public static DataTable Select(string sql) { using (DbConnection conn = factory.CreateConnection()) { try { conn.Co... 阅读全文
posted @ 2008-03-18 15:47 阿春 阅读(169) 评论(0) 推荐(1)
给一个文本 和 编码类型 转换成 规定类型的 URL 编码
摘要:给一个文本 和 编码类型 转换成 规定类型的 URL 编码 public static string GetUrlEncode(string s, System.Text.Encoding e) { if (s.Trim() != "") { return HttpUtility.Ur... 阅读全文
posted @ 2008-03-16 23:52 阿春 阅读(246) 评论(0) 推荐(0)
C#采集器
摘要:http://www.cnblogs.com/duoe/archive/2007/12/16/996664.html 阅读全文
posted @ 2008-03-07 17:07 阿春 阅读(535) 评论(0) 推荐(0)
ss
摘要:HtmlWeb hw = new HtmlWeb(); hw.DefaultEncoding = System.Text.Encoding.GetEncoding("gb2312"); string url = @"http://bbs.99read.com"; HtmlDocument doc = hw.Load(url);... 阅读全文
posted @ 2008-03-06 23:48 阿春 阅读(326) 评论(0) 推荐(0)
触发器
摘要:1.更新操作 CREATE TRIGGER UpdateStuNameTrigger ON 学生信息 AFTER UPDATE AS BEGIN declare @Name varchar(20) declare @Id int select @Id=学号,@Name=姓名 from inserted update 成绩表 set 姓名=@Name where 学号... 阅读全文
posted @ 2008-03-02 17:04 阿春 阅读(115) 评论(0) 推荐(0)
防止注入的sql调用
摘要:int KeChengHao = int.Parse(this.textBox1.Text.Trim()); System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection("Data Source=127.0.0.1;Initial Catalog=Student;Use... 阅读全文
posted @ 2008-03-01 23:34 阿春 阅读(159) 评论(0) 推荐(0)
程序调用sql
摘要://// delete from 课程表 where 课程号=1 or 1=1 string sql = this.textBox1.Text.Trim(); System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection("Data Source=... 阅读全文
posted @ 2008-03-01 23:33 阿春 阅读(166) 评论(0) 推荐(0)
程序调用存储过程
摘要://exec Delete_kc 6 int KeChengHao = int.Parse(this.textBox1.Text.Trim()); System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection("Data Source=127.0.... 阅读全文
posted @ 2008-03-01 23:31 阿春 阅读(186) 评论(0) 推荐(0)
sql 语句
摘要:create database stu use stu create table Table_1(学号 int null,姓名 nvarchar(50) null,年龄 int null,系别 nvarchar(50) null) create table Table_3(学号 int IDENTITY(1,1) PRIMARY KEY,姓名 nvarchar(50) null,年龄 int nu... 阅读全文
posted @ 2008-03-01 19:53 阿春 阅读(186) 评论(0) 推荐(0)
sql 存储过程
摘要:1.CREATE PROCEDURE Delete_kc @课程号 int AS BEGIN delete from 课程表 where 课程号=@课程号 END exec Delete_kc 6 (执行存储过程) 2. alter修改存储过程 ALTER PROCEDURE Insert_kc @课程名 varchar(20) AS BEGIN inser... 阅读全文
posted @ 2008-03-01 19:39 阿春 阅读(245) 评论(0) 推荐(0)
SQL中字段值判断
摘要:select 学号, 姓名, case when(性别=0) then '男' else '女' end 性别, 年龄 from 学生信息 阅读全文
posted @ 2008-03-01 12:34 阿春 阅读(700) 评论(0) 推荐(0)