asp链接sql数据库 代码
dim conn,connstr
Set conn = Server.CreateObject("ADODB.Connection")'创建一个数据库链接对象conn,方便后面调用
connstr="Provider=SQLOLEDB;Data Source=(local);Initial Catalog=111;User ID=sa;Password=1234;" '创建一个数据库的recordset对象,方便以后调用
conn.Open connstr'打开数据库
相关文档:
在SQL Server2005中有FOR XML 用法,可以讲一个表作为一个字段。
我的设计想法主要是用在1对多的关系中表读取的问题。
表A 表B
在A中有一条记录而在B中有多条记录可以参照下面的写法:(我的项目中用到的,修改了字段主要是演示用)
select A.*,
(SELECT a, CAST(G_Univalence AS NVARCHAR(48)) AS G_Univa ......
随着Visual Studio 2010的发布,Microsoft SQL Server Compact 3.5也升级为Microsoft
SQL Server Compact SP2。
下载地址如下:
SQL
Server Compact 3.5 SP2 for Windows mobile devices (all platforms &
processors)
SQL
Server Compact 3.5 SP2 for Windows desktop (32-bit and 64-bit)
  ......
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[f_convert]') and xtype in (N'FN', N'IF', N'TF'))&n ......
如图1、2,id=1的数据是NULL,其他的为非NULL的数据。
一般情况下,会用两种方法!
方法1.t-sql:insert into E values(1,'NULL'),插入后,在打开表的情况下看到的
是'NULL'(我想是为了区分NULL,才加的引号),但是查询的时候不影响,显示的是NULL,
如图1、2,id为6的数据。
如果要插入带单引号的'NULL',insert i ......
--该表保存结果
create table c(c1 tinyint, c2 tinyint, c3 tinyint, c4 tinyint, c5 tinyint, c6 tinyint, c7 tinyint, c8 tinyint, c9 tinyint, c10 tinyint, c11 tinyint, c12 tinyint, c13 tinyint, c14 tinyint, c15 tinyint, c16 tinyint, c17 tinyint, c18 tinyint, c19 tinyint, c20 tinyint, c21 tinyint, c22 t ......