C#中用于连接SQL数据库的SQLHelper类
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient; //引用命名空间
namespace DAL
{
/*******************************************************************************
* Name: SQLHelper
* File: SQLHelper.cs
* Description: 用于完成对数据库的相关操作
* Author: 雪狼
* DateTime: 2010年05月13日
*******************************************************************************/
public class SQLHelper
{
//设置连接字符串 —— SQL Server验证模式的连接字符串
//public static string strConn = @"server = PANLING;database = StudentMIS;uid = sa;pwd = sa";
//设置连接字符串 —— Windows验证模式的连接字符串
public static string strConn = @"server = T403-004\HB_SQLSERVER;database = DB_LibraryManage;Integrated Security = SSPI";
/// <summary>
/// 功能描述:执行ADO.NET增、删、改操作
/// </summary>
/// <param name="strText">输入参数 —— 要执行的SQL语句(命令文本)</param>
/// <param name="cmdType">输入参数 —— 要执行的SQL命令类型</param>
/// <param name="SqlParams">输入参数 —— 要执行的SQL语句中的参数列表(命令参数列表)</param>
/// <returns>返回执行影响的行数</returns>
public static int MyExecu
相关文档:
1.删除表
select 'drop table ' || table_name || ' purge;'
from user_tables
where length(table_name) <= 4;
删除带约束的表
Drop table 表名 cascade constraints;
2.查询view&同义词
--说明:可以根据视图的text_length ......
问题及描述:
--1.学生表
Student(S#,Sname,Sage,Ssex) --S# 学生编号,Sname 学生姓名,Sage 出生年月,Ssex 学生性别
--2.课程表
Course(C#,Cname,T#) --C# --课程编号,Cname 课程名称,T# 教师编号
--3.教师表
Teacher(T#,Tname) --T# 教师编号,Tname 教师姓名
--4.成绩表
SC(S#,C#,score) --S# 学生编号,C# 课程 ......
C#生成com组件,供asp调用
一、vs2005—新建项目—C#类库
类库源码如下(包含接口,类,事件接口):
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Data.SqlClient;
using System.Runtime.InteropServices;
namespace entryclass
{
  ......
1。企业管理器
打开你建有外键的表--右击表--设计表--在上方点开’管理约束‘--将级连删除和级连更新的沟打上就可以了
2。查询分析器
alter table sc
add
constraint forei ......
不喷口水!直接上图
1.数据库对象检索功能
2.T-SQL语法帮助
3.常用函数帮助(不懂鸟语?13自己练练吧!)
Download Now
安装流程:
1.先把网络咔叉了(断网 - -!!)
2.把所有的SQL Server,VS都关了,运行SQLPrompt 4.0.exe安装
3.安装完毕后,退出RedGate.SQLPrompt.TrayApp ......