首页 >> 读书频道 >> 电脑 >> 如何用ASP远程在数据库中创建Table
 
· SQL数据库的一些攻击
· 自动获得下一记录ID号码
· ADO如何锁定Recor
· 将数据库的内容放到下拉列
· 何得知Recordset
· 用GetString来提
· 何存取三层式结构的数据库
· 当Recordcount
· 如何实现多记录的分页显示
· 在ASP中用集合成批操作
· RecordSet的Lo
· RecordSet的Cu
 
· 全唐诗卷四十六
· 韩剧《布拉格恋人》剧情介
· 夜航船[作者:明·张岱]
· 局外人[作者:韩·可爱淘
· 现场流行病学
· 源氏物语[日本:紫式部]
· 红楼梦:120回全本[清
· 武林寓言故事
· 2006高考录取规则
· 首批中国世界名牌产品和2
· 济南美食大全
· 管理三十六计
 
· (出租)中动商场部分及写
· (出租)中动动漫基地&#
· 喜剧学院
· 《善德女王》剧情介绍
· 魔女18号 剧情
· 丑女无敌剧情介绍
· 魔女幼熙剧情介绍
· 龙游天下剧情介绍
· 震撼世界的七日剧情介绍
· 静静的白桦林剧情介绍
· 心情日记—老公今天我想对
· 旗舰剧情介绍
欢迎来到月影社区!如果您觉得这里不错,请推荐给您的朋友们。月影社区:http://wf66.com/

如何用ASP远程在数据库中创建Table


查看有无更新版本

关键字:ASP与数据库 2006-8-28

 

Dim objRS
Set objRS = Server.CreateObject( "ADODB.Recordset" )
objRS.CursorLocation = adUseClient
 

objRS.Fields.Append "Product", adBSTR
objRS.Fields.Append "Quantity", adInteger
objRS.Fields.Append "Unit Price", adCurrency
 

objRS.Open
objRS.AddNew
An empty record now exists; you just need to set the values.

objRS.Fields( "Product" ).value = "1969 Camero RS"
objRS.Fields( "Quantity" ).value = 3
objRS.Fields( "Unit Price" ).value = 2000.40
And finally Update() is called to save the changes.

objRS.Update
 

ADO Added Value
If that were all, using ADO in this way would be no better than using
arrays. However, you now get to use all that great functionality
built into ADO. Let's look at some specific examples.

Methods
There are many methods available in ADO used for data manipulation. A
popular feature is sorting. Instead of writing code to sort an array
you can store the data in an ADO Recordset object and sort it.

objRS.Sort = "Product"
This creates a temporary index based on the Product field, so when
the records are accessed they will be returned in a sorted order.

Streaming
Data in a recordset can be streamed out as a string. An example of
its use is building a comma-delimited file to import into Excel. Here
is an example:

asString = objRS.GetString( adClipString, , "," )
The method GetString() starts at the current cursor position, so be
sure to call MoveFirst if you intend to stream all the records. The
parameters to GetString() allow you to control the number of rows to
convert, the column delimiter, the row delimiter and the expression
used for a NULL field.

Persistence
Persisting data to a file so that a data structure can be
reconstructed later is tedious if you are using standard data types,
since you have to create your own persistence mechanism. ADO has
persistence built in so you get it for free. To write your recordset
to a file just call Save() .

objRS.Save "theOrder.dat", adPersistADTG
The file type in this case is "Advanced Data Tablegram" format. This
is a proprietary Microsoft format, so it is only really useful for
storing a recordset in a file. The only other option is adPersistXML.

To reconstruct the recordset from the file just do the following:

Dim objRS2
Set objRS2 = Server.CreateObject( "ADODB.Recordset" )
objRS2.Open "theOrder.dat"

如何用ASP远程在数据库中创建Table

[ 1 ]
如何用ASP远程在数据库中创建Table num

打印本页 关闭

关于我们版权声明本站导航友情连结作品演示 TOP↑