随笔分类 - 数据库
ADO 访问数据库
摘要:usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Text;usingSystem.Windows.Forms;namespaceWindowsApplication1{publicpartialclassForm1:Form{///<summary>//////</summary>privateADODB.Connectioncn=newADODB.Connection();///
阅读全文
數據庫查詢
摘要:如下兩個表(A)IDaName---------------------------------1a2b3c4d5e(B)IDbName---------------------------------4d5e6f7g8h查詢結果IDaNamebName---------------------------------------------------------1aNULL2bNULL3cNULL4dd5ee6NULLf7NULLg8NULLhcreatetableA(IDintprimarykey,aNamevarchar(50))createtableB(IDintprimarykey
阅读全文
數據庫常用修改操作說明
摘要:--修改表IFEXISTS(SELECT*FROMsysobjectsWHEREtype='U'ANDname='test')begindroptabletestendGOcreatetabletest(TIDintprimarykeyidentity(1,1),TNamevarchar(50)--修改視圖IFEXISTS(SELECT*FROMsysobjectsWHEREtype='V'ANDname='view_select')begindropviewview_selectendGOcreateviewview_selec
阅读全文
从数据库中读取数据创建菜单
摘要:usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Text;usingSystem.Windows.Forms;usingSystem.Data.SqlClient;namespaceWindowsForm...{publicpartialclassForm1:Form...{privateMenuStripmainmenu=newMenuStrip();privateToolStripMenuItemfi
阅读全文
存储过程与触发器Web调用代码
摘要:usingSystem;usingSystem.Collections.Generic;usingSystem.Text;usingSystem.Data;usingSystem.Configuration;usingSystem.Data.SqlClient;namespaceWangKang.DataBase...{publicclassWebDB:DB...{privatestringconnstring=ConfigurationManager.ConnectionStrings["connectionString"].ConnectionString;//查询所有
阅读全文
Win调用
摘要:usingSystem;usingSystem.Collections.Generic;usingSystem.Text;usingSystem.Data;usingSystem.Configuration;usingSystem.Windows.Forms;usingSystem.Data.SqlClient;namespaceWangKang.DataBase...{publicclassWinDB:DB...{privatestringconnstring=@"DataSource=.SQLEXPRESS;IntegratedSecurity=True;UserInstance
阅读全文
触发器、存储过程和事务处理使用
摘要:--创建数据库scrolldynamiccreatedatabaseDatabase1GO--置此数据库为当前数据库useDatabase1GO--创建学生表createtablestudent(SIDvarchar(20)primarykey,--学生编号SNamevarchar(20),--学生姓名SClassvarchar(20),--学生班级SSexvarchar(10),--学生性别SScorefloatdefault(0)check(SScore>=0)--学生平均分)GO--创建课程表createtableclass(EIDvarchar(20)primarykey,--课
阅读全文
海量数据库的查询优化及分页算法方案
摘要:海量数据库的查询优化及分页算法方案(一)深入浅出理解索引结构 实际上,您可以把索引理解为一种特殊的目录。微软的SQL SERVER提供了两种索引:聚集索引(clustered index,也称聚类索引、簇集索引)和非聚集索引(nonclustered index,也称非聚类索引、非簇集索引)。下面,我们举例来说明一下聚集索引和非聚集索引的区别: 其实,我们的汉语字典的正文本身就是一个聚集索引。比如,我们要查“安”字,就会很自然地翻开字典的前几页,因为“安”的拼音是“an”,而按照拼音排序汉字的字典是以英文字母“a”开头并以“z”结尾的,那么“安”字就自然地排在字典的前部。如果您翻完了所有以“a
阅读全文
存储过程简单操作
摘要:/**//************************************************作者:王康*作用:存储过程简单操作*时间:2006/9/16***********************************************/--创建数据库--createdatabasetest--GO--usetest--GO----创建表--createtabletest(testIDintprimarykeyidentity(1,1),testNamevarchar(10))--GO----创建插入存储过程--createproceduresp_insertTest(
阅读全文
ADO.NET 示例应用程序
摘要:下面是一个简单的 ADO.NET 应用程序,它从数据源中返回结果并将输出写至控制台或命令提示符窗口。通过 ADO.NET 访问数据中提供的示例代码的大部分都可以放入利用此示例创建的模板,以查看特定 ADO.NET 功能的工作示例。本主题中的示例代码显示 ADO.NET 应用程序中包含的典型命名空间。对 SQL Server .NET Framework 数据提供程序 (System.Data.SqlClient)、OLE DB .NET Framework 数据提供程序 (System.Data.OleDb)、ODBC .NET Framework 数据提供程序 (System.Data.Od
阅读全文
数据库的连接
摘要:SQL 数据库的连接using System;using System.Data;using System.Data.SqlClient;namespace DataReader1App{ /// <summary> /// Class1 的摘要说明。 /// </summary> class Class1 { /// <summary> /// 应用程序的主入口点。 /// </summary> [STAThread] static void Main(string[] args) { // // TODO: 在此处添加代码以启动应用程序 //
阅读全文
ADO.NET快速起步
摘要:ADO.NET是微软的Microsoft ActiveX Data Objects (ADO)的下一代产品,是在微软的.NET中创建分布式和数据共享应用程序的应用程序开发接口(API)。 ADO.NET能被用在任何用户的应用程序,需要和OLE DB-compliant的数据源连接和通讯,例如Microsoft SQL Server。 同时ADO.NET又保持着与以前的ADO模型有关的一些主要概念,它已经被极大的完善,并从不同的信息来源提供途径去获得结构化的数据----一个平台文本文件,从数据库管理系统获得的相关数据,或者是分级的XML数据----然而,所有都按照一个相容的,标准化的设计模型来执
阅读全文
浙公网安备 33010602011771号