succeeded原型 successful

热门职校 2025-02-10 10:33:56

All the students envied him __hing succeeded in the TOFEL test A.as B.for C.in D.with

B 解释是因为的意思

succeeded原型 successfulsucceeded原型 successful


succeeded原型 successful


succeeded原型 successful


succeeded原型 successful


succeeded原型 successful


因为过了托福考试而嫉妒- =

B ,因为,as后面要跟个句子,才可以,而后面的成份缺少主语。For加后面的成份构成了一个表原因的短语,他通过了托福考试是大家嫉妒他的原因。懂了么?

原型envy 嫉妒 的意思。

adj. 被妒忌的, 被羡慕的

B

英语中虚拟语气的讲解

虚拟语气

一. 概念:用来表示说话人的主观愿望或想所说的是一个条件,不一定是事实,或与事实相反。

二.真实条件句用陈述语气

1.真实条件句表示的想是真实的或有可能性

2.句型:条件从句(一般现在时)+主句(shall/will+动词原形)

3.注意:当表示真理时,主句谓语动词不用shall/will+动词原形,而直接用一般现在时

三.虚拟语气用于非真实条件句中

1.表示同现在事实相反的想,可以表示现在,过去或将来的情况

2.表示同过去事实相反的想

句型:条件从句(过去完成时had done)+主句(should/would he+过去分词)

3.表示对将来的想

句型:①条件从句为一般过去式;主句为should+动词原形

②条件从句为were+动词原形;主句为would

③条件从句为should+动词原形; 主句为would

4.表示错综复杂的条件

有时,主句与从句的动作发生在不同的时间,一个发生在过去,一个发生在现在。

5.虚拟条件句的倒装

虚拟条件句的从句部分含有were, should, 或had时, 可省略if,再把were, should或had 移到从句的句首,实行倒装。

6.特殊的虚拟语气词should

1)在主语从句中的应用

It is demanded / necessary / a pity + that…等结构的主语从句,谓语动词用should 加动词原形,should 可省略。

It is 可用的词有三类 that (should)do

suggested, ordered, required, proed, demanded, requested, insisted等

important, necessary, natural, imperative, strange等

a pity, a shame, no wonder等

2)在宾语从句中的应用

在表示命令、建议、要求等一类动词后面的从句中,像order, suggest, proe, require, demand, request, insist, command, insist + (should) do等。例如:

I suggest that we (should) hold a meeting next week. 我建议下周召开个会议。

He insisted that he (should ) be sent there.他要求被派到那儿去。

注意:如suggest, insist不表示"建议" 或"坚持要某人做某事时",即它们用于其本意"暗示、表明"、"坚持认为"时,宾语从句用陈述语气。

3)在表语从句,同位语从句中的应用

suggestion, proal, idea, plan, order, a等名词后面的表语从句、同位语从句中要用虚拟语气,即(should)+动词原形。

wish的用法

1)wish后面的从句,表示与事实相反的情况,或表示将来不太可能实现的愿望。其宾语从句的动词形式为:

主句 从句

从句动作先于主句动词动作(be的过去式为 were) 现在时 过去时

从句动作与主句动作同时发生(had + 过去分词) 过去时 过去完成时

将来不大可能实现的愿望 将来时 would/could +动词原形

8. 比较if only与only if

only if表示"只有";if only则表示"如果……就好了"。If only也可用于陈述语气。

9.It is (high) time that

It is (high) time that 后面的从句谓语动词要用过去式或用should加动词原形,但should不可省略。

10.need "不必做"和"本不必做"

didn't need to do表示过去不必做某事, 事实上也没做。

needn't he done表示过去不必做某事, 但事实上做了。

相关练习题

1.(B)The volleyball match will be put off if it ___.

A. will rain

B. rains

C. rained

D. is rained

考点:真实条件句主句为将来时,从句用一般现在时。

注意:

1)在真实条件句中,主句不能用be going to表示将来,该用shall, will.

(错) If you lee now, you are nr going to regret it.

(对) If you lee now, you will nr regret it.

2)表示真理时,主句谓语动词不用shall (will) +动词原形,而直接用一般现在时的动词形式

1.(C)_____ to do the work, I should do it some other day.

A. If were I

B. I were

C. Were I

D. Was I

考点:在虚拟条件状语中如果有were, should, had这三个词,通常将if省略,主语提前, 变成 were, should, had +主语的形式。但要注意,在虚拟条件状语从句中,省略连词的倒装形式的句首不能用动词的缩略形式。如我们可说 Were I not to do, 而不能说 Weren't I to do。

2.(D)There was plenty of time. She ___.

A. mustn't he hurried

B. couldn't he hurried

C. must not hurry

D. needn't he hurried

考点:needn't he done. 意为"本不必",即已经做了某事,而时实际上不必要。

Mustn't he done 用法不正确,对过去发生的事情进行否定性推断应为couldn't he done, "不可能已经"。 must not do 不可以(用于一般现在时)。

虚拟语气经典习题

1. If I had had enough time, I my work.

A. would finish

B. must he finished

C. would he finished

D. had finished

2. Ten minutes earlier, they the plane.

A. will catch

B. would catch

C. would he caught

D. will he caught

3. Mr. Green requires that the students a comition ry other week.

A. write

B. written

C. would write

D. will write

4. Had he studied hard, he the exam.

A. would pass

B. could pass

C. had passed

D. would he passed

5. I wish I what is happening there in his room.

A. know

B. known

C. knew

D. should know

6. It is important that you sports ry day.

A. he

B. would he

C. must he

D. will he

7. If there were no water in the world, rything .

A. will die

B. would die

C. would he died

D. would he been dead

8. What was going to happen ,I would nr he left her alone.

A. Had I known

B. If I know

C. If I knew

D. If had I known

9. He ordered that the work

A. should finish

B. finished

C. would be finished

D. be finished .

10. — Shall we go to the movie tonight?

— No, I’d rather at home with our baby. You’d better not lee it to the babysitter at night.

A. you stayed

B. you stay

C. stayed

D. stay

11 . in your ition, I would him.

A. Was I

B. Were I

C. If I am

D. If I had been

12. I , but I was stopped by the hey rain.

A. mean to come

B. meant to come

C. had meant to come

D. meant coming

13. Mrs. Black insists in that old ho.

A. not to stay

B. not staying

C. staying not

D. that he not stay

14. If you had spoken clearly, you would .

A. understand it

B. he understood

C. be understood

D. he been understood

15. If you that late movie last night, you wouldn’t be so sleepy.

A. hen’t watched

B. hadn’t watched

C. didn’t watch

D. wouldn’t he watched

16.The foreign friend speaks Chinese so well as if he a Chinese. A. is

B. be

C. should be

D. were

17. — If he , he that food.

— Luckily he was sent to the hospital immediay.

A. was warned; would not take

B. would be warned; had not take

C. had been warned; would not he taken

D. would he been warned; had not taken

18. Without electronic comrs, much of today’s aanced technology achid.

A. will not be

B. would not be

C. would not he been

D. cannot he been

19.There was plenty of time. She ___.

A. mustn’t he hurried

B. couldn’t he hurried

C. must not hurry

D. needn’t he hurried

D。needn’t he done. 意为"本不必",即已经做了某事,而时实际上不必要。

Mustn’t he done 用法不正确,对过去发生的事情进行否定性推断应为couldn’t he done, "不可能已经"。 must not do 不可以(用于一般现在时)。

20. We had hoped that he ____ longer.

A. stays

B. he stayed

C.stayed

D. would stay

解析:该题正确为D。had hoped表示"本希望",同样用法的动词还有think, expect等,后面的句子需用虚拟语气

21."Mary wants to see you today".

"I would rather she ____ tomorrow than today." come

D.will come

解析:该题正确为B。would rather后面的从句需用虚拟语气,用动词过去时表示。

22.Had she been older, she ____ it better.

A.had done

B.might he done

C.might do

D.would do

解析:Had she been older = If she had been old.故该题正确为B。

A.should finish

B.finished

C.would be finished

D.be finished

一。用来表示说话人的主观愿望或想所说的是一个条件,不一定是事实,或与事实相反。

二.真实条件句用陈述语气

1.真实条件句表示的想是真实的或有可能性

2.句型:条件从句(一般现在时)+主句(shall/will+动词原形)

3.注意:当表示真理时,主句谓语动词不用shall/will+动词原形,而直接用一般现在时

三.虚拟语气用于非真实条件句中

1.表示同现在事实相反的想,可以表示现在,过去或将来的情况

2.表示同过去事实相反的想

句型:条件从句(过去完成时had done)+主句(should/would he+过去分词)

3.表示对将来的想

句型:①条件从句为一般过去式;主句为should+动词原形

②条件从句为were+动词原形;主句为would

③条件从句为should+动词原形; 主句为would

4.表示错综复杂的条件

有时,主句与从句的动作发生在不同的时间,一个发生在过去,一个发生在现在。

5.虚拟条件句的倒装

虚拟条件句的从句部分含有were, should, 或had时, 可省略if,再把were, should或had 移到从句的句首,实行倒装。

6.特殊的虚拟语气词should

1)在主语从句中的应用

It is demanded / necessary / a pity + that…等结构的主语从句,谓语动词用should 加动词原形,should 可省略。

It is 可用的词有三类 that (should)do

suggested, ordered, required, proed, demanded, requested, insisted等

important, necessary, natural, imperative, strange等

a pity, a shame, no wonder等

2)在宾语从句中的应用

在表示命令、建议、要求等一类动词后面的从句中,像order, suggest, proe, require, demand, request, insist, command, insist + (should) do等。例如:

I suggest that we (should) hold a meeting next week. 我建议下周召开个会议。

He insisted that he (should ) be sent there.他要求被派到那儿去。

注意:如suggest, insist不表示"建议" 或"坚持要某人做某事时",即它们用于其本意"暗示、表明"、"坚持认为"时,宾语从句用陈述语气。

3)在表语从句,同位语从句中的应用

suggestion, proal, idea, plan, order, a等名词后面的表语从句、同位语从句中要用虚拟语气,即(should)+动词原形。

wish的用法

1)wish后面的从句,表示与事实相反的情况,或表示将来不太可能实现的愿望。其宾语从句的动词形式为:

主句 从句

从句动作先于主句动词动作(be的过去式为 were) 现在时 过去时

从句动作与主句动作同时发生(had + 过去分词) 过去时 过去完成时

将来不大可能实现的愿望 将来时 would/could +动词原形

8. 比较if only与only if

only if表示"只有";if only则表示"如果……就好了"。If only也可用于陈述语气。

9.It is (high) time that

It is (high) time that 后面的从句谓语动词要用过去式或用should加动词原形,但should不可省略。

10.need "不必做"和"本不必做"

didn't need to do表示过去不必做某事, 事实上也没做。

needn't he done表示过去不必做某事, 但事实上做了。

相关练习题

1.(B)The volleyball match will be put off if it ___.

A. will rain

B. rains

C. rained

D. is rained

考点:真实条件句主句为将来时,从句用一般现在时。

注意:

1)在真实条件句中,主句不能用be going to表示将来,该用shall, will.

(错) If you lee now, you are nr going to regret it.

(对) If you lee now, you will nr regret it.

2)表示真理时,主句谓语动词不用shall (will) +动词原形,而直接用一般现在时的动词形式

1.(C)_____ to do the work, I should do it some other day.

A. If were I

B. I were

C. Were I

D. Was I

考点:在虚拟条件状语中如果有were, should, had这三个词,通常将if省略,主语提前, 变成 were, should, had +主语的形式。但要注意,在虚拟条件状语从句中,省略连词的倒装形式的句首不能用动词的缩略形式。如我们可说 Were I not to do, 而不能说 Weren't I to do。

2.(D)There was plenty of time. She ___.

A. mustn't he hurried

B. couldn't he hurried

C. must not hurry

D. needn't he hurried

考点:needn't he done. 意为"本不必",即已经做了某事,而时实际上不必要。

Mustn't he done 用法不正确,对过去发生的事情进行否定性推断应为couldn't he done, "不可能已经"。 must not do 不可以(用于一般现在时)。

虚拟语气经典习题

1. If I had had enough time, I my work.

A. would finish

B. must he finished

C. would he finished

D. had finished

2. Ten minutes earlier, they the plane.

A. will catch

B. would catch

C. would he caught

D. will he caught

3. Mr. Green requires that the students a comition ry other week.

A. write

B. written

C. would write

D. will write

4. Had he studied hard, he the exam.

A. would pass

B. could pass

C. had passed

D. would he passed

5. I wish I what is happening there in his room.

A. know

B. known

C. knew

D. should know

6. It is important that you sports ry day.

A. he

B. would he

C. must he

D. will he

7. If there were no water in the world, rything .

A. will die

B. would die

C. would he died

D. would he been dead

8. What was going to happen ,I would nr he left her alone.

A. Had I known

B. If I know

C. If I knew

D. If had I known

9. He ordered that the work

A. should finish

B. finished

C. would be finished

D. be finished .

10. — Shall we go to the movie tonight?

— No, I’d rather at home with our baby. You’d better not lee it to the babysitter at night.

A. you stayed

B. you stay

C. stayed

D. stay

11 . in your ition, I would him.

A. Was I

B. Were I

C. If I am

D. If I had been

12. I , but I was stopped by the hey rain.

A. mean to come

B. meant to come

C. had meant to come

D. meant coming

13. Mrs. Black insists in that old ho.

A. not to stay

B. not staying

C. staying not

D. that he not stay

14. If you had spoken clearly, you would .

A. understand it

B. he understood

C. be understood

D. he been understood

15. If you that late movie last night, you wouldn’t be so sleepy.

A. hen’t watched

B. hadn’t watched

C. didn’t watch

D. wouldn’t he watched

16.The foreign friend speaks Chinese so well as if he a Chinese. A. is

B. be

C. should be

D. were

17. — If he , he that food.

— Luckily he was sent to the hospital immediay.

A. was warned; would not take

B. would be warned; had not take

C. had been warned; would not he taken

D. would he been warned; had not taken

18. Without electronic comrs, much of today’s aanced technology achid.

A. will not be

B. would not be

C. would not he been

D. cannot he been

19.There was plenty of time. She ___.

A. mustn’t he hurried

B. couldn’t he hurried

C. must not hurry

D. needn’t he hurried

D。needn’t he done. 意为"本不必",即已经做了某事,而时实际上不必要。

Mustn’t he done 用法不正确,对过去发生的事情进行否定性推断应为couldn’t he done, "不可能已经"。 must not do 不可以(用于一般现在时)。

20. We had hoped that he ____ longer.

A. stays

B. he stayed

C.stayed

D. would stay

解析:该题正确为D。had hoped表示"本希望",同样用法的动词还有think, expect等,后面的句子需用虚拟语气

who succeeded he中的he为什么是原型

因为he在此处做谓语,所以可以用原型。其中who succeeded做定语,这几个单词前面应该还有所指代的主语,he就做主语的谓语。

资料延伸:

who是关系代名词。

看来你要把关系代名词再学一学,看下面:

who Which that

修饰人 修饰事物 可修饰人、事物

i like the boy that is playing basketball.

= I like the boy who is playing basketball.

I he a cell phone that can send e-mail.

= I he a cell phone which can send e-mail

以上的关系代名词(that,who,which)都是当主词

That is the girl.

Everyone likes the girl.

合并成 => That is the girl who (that) ryone likes.

主词 Who Which that

受词 Who(口语)

Whom(文法) which that

例:He is the person whom (who,that) you talked about yesterday.

关系代名词当受词用时,可以省略。

谢谢采纳!

Was your school trip to the mountains____? Asucceed Bsucceeded Csuccessful Dsuccessfully

应该选C吧、

首先来分析句子、

换成陈述句就是、

your school trip to the mountains was ( ) 、

很明显这里要填的词是要做表语的、

形容词充当表语、

successful是形容词、

翻译是、

你学校的郊游很么、?

恩ALL、

学习进步。

选C,成功的,形容词,A和B分别是成功的动词及其过去式,D是副词,成功地。根据题意选形容词C

选C

急。。哪位高手,能详细的给我讲一下vc连接数据库的步骤。。。着急用,,谢谢。

用ADO连接数据库 最方便

一、ADO

ADO(ActiveX Data Object)是Microsoft数据库应用程序开发的新接口,是建立在OLE DB之上的高层数据库访问技术,请不必为此担心,即使你对OLE DB,COM不了解也能轻松对付ADO,因为它非常简单易用,甚至比你以往所接触的ODBC API、DAO、RDO都要容易使用,并不失灵活性。本文将详细地介绍在VC下如何使用ADO来进行数据库应用程序开发,并给出示例代码。

本文示例代码

二、基本流程

万事开头难,任何一种新技术对于初学者来说最重要的还是“入门”,掌握其要点。让我们来看看ADO数据库开发的基本流程吧!

(1)初始化COM库,引入ADO库定义文件

(2)用Connection对象连接数据库

(3)利用建立好的连接,通过Connection、Command对象执行SQL命令,或利用Recordset对象取得结果记录集进行查询、处理。

(4)使用完毕后关闭连接释放对象。

准备工作:

为了大家都能测试本文提供的例子,我们采用Access数据库,您也可以直接在我们提供的示例代码中找到这个test.mdb。

下面我们将详细介绍上述步骤并给出相关代码。

【1】COM库的初始化

我们可以使用AfxOleInit()来初始化COM库,这项工作通常在CWinApp::InitInstance()的重载函数中完成,请看如下代码:

BOOL CADOTest1App::InitInstance()

{AfxOleInit();

......

【2】用#import指令引入ADO类型库

我们在stdafx.h中加入如下语句:(stdafx.h这个文件哪里可以找到?你可以在FileView中的Header Files里找到)

#import "c:program filescommon filesadomsado15.dll" no_namespace rename("EOF","adoEOF")

这一语句有何作用呢?其最终作用同我们熟悉的#include类似,编译的时候系统会为我们生成msado15.tlh,ado15.tli两个C++头文件来定义ADO库。

几点说明:

(1) 您的环境中msado15.dll不一定在这个目录下,请按实际情况修改

(2) 在编译的时候肯能会出现如下,对此微软在MSDN中作了说明,并建议我们不要理会这个。

msado15.tlh(405) : warning C4146: unary minus operator applied to unsigned type, result still unsigned

【3】创建Connection对象并连接数据库

首先我们需要添加一个指向Connection对象的指针:

_ConnectionPtr m_pConnection;

下面的代码演示了如何创建Connection对象实例及如何连接数据库并进行异常捕捉。

BOOL CADOTest1Dlg::OnInitDialog()

{CDialog::OnInitDialog();

HRESULT hr;

try

{hr = m_pConnection.CreateInstance("ADODB.Connection");///创建Connection对象

if(SUCCEEDED(hr))

{hr = m_pConnection->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=test.mdb","","",adModeUnknown);///连接数据库

///上面一句中连接字串中的Provider是针对ACCESS2000环境的,对于ACCESS97,需要改为:Provider=Microsoft.Jet.OLEDB.3.51; }

}catch(_com_error e)///捕捉异常

{CString errormessage;

errormessage.Format("连接数据库失败!rn错误信息:%s",e.ErrorMessage());

AfxMessageBox(errormessage);///显示错误信息

}在这段代码中我们是通过Connection对象的Open方法来进行连接数据库的,下面是该方法的原型

HRESULT Connection15::Open ( _bstr_t ConnectionString, _bstr_t UserID, _bstr_t Password, long Options )

ConnectionString为连接字串,UserID是用户名, Password是登陆密码,Options是连接选项,用于指定Connection对象对数据的更新许可权,

Options可以是如下几个常量:

adModeUnknown:缺省。当前的许可权未设置

adModeRead:只读

adModeWrite:只写

adModeReadWrite:可以读写

adModeShareDenyRead:阻止其它Connection对象以读权限打开连接

adModeShareDenyWrite:阻止其它Connection对象以写权限打开连接

adModeShareExclusive:阻止其它Connection对象打开连接

adModeShareDenyNone:允许其它程序或对象以任何权限建立连接

我们给出一些常用的连接方式供大家参考:

(1)通过JET数据库引擎对ACCESS2000数据库的连接

m_pConnection->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:test.mdb","","",adModeUnknown);

(2)通过DSN数据源对任何支持ODBC的数据库进行连接:

m_pConnection->Open("Data Source=adotest;UID=sa;PWD=;","","",adModeUnknown);

(3)不通过DSN对SQL SERVER数据库进行连接: m_pConnection->Open("driver={SQL };=127.0.0.1;DATABASE=vckbase;UID=sa;PWD=139","","",adModeUnknown);

其中是SQL的名称,DATABASE是库的名称

Connection对象除Open方法外还有许多方法,我们先介绍Connection对象中两个有用的属性ConnectionTimeOut与State

ConnectionTimeOut用来设置连接的超时时间,需要在Open之前调用,例如: m_pConnection->ConnectionTimeout = 5;///设置超时时间为5秒

m_pConnection->Open("Data Source=adotest;","","",adModeUnknown);

State属性指明当前Connection对象的状态,0表示关闭,1表示已经打开,我们可以通过读取这个属性来作相应的处理,例如:

if(m_pConnection->State)

m_pConnection->Close(); ///如果已经打开了连接则关闭它

【4】执行SQL命令并取得结果记录集

为了取得结果记录集,我们定义一个指向Recordset对象的指针:_RecordsetPtr m_pRecordset;

并为其创建Recordset对象的实例: m_pRecordset.CreateInstance("ADODB.Recordset");

SQL命令的执行可以采用多种形式,下面我们一进行阐述。

(1)利用Connection对象的Execute方法执行SQL命令

Execute方法的原型如下所示:

_RecordsetPtr Connection15::Execute ( _bstr_t CommandText, VARIANT RecordsAffected, long Options ) 其中CommandText是命令字串,通常是SQL命令。参数RecordsAffected是作完成后所影响的行数, 参数Options表示CommandText中内容的类型,Options可以取如下值之一:

adCmdText:表明CommandText是文本命令

adCmdTable:表明CommandText是一个表名

adCmdProc:表明CommandText是一个存储过程

adCmdUnknown:未知

Execute执行完后返回一个指向记录集的指针,下面我们给出具体代码并作说明。 _variant_t RecordsAffected;

///执行SQL命令:CREATE TABLE创建表格users,users包含四个字段:整形ID,字符串username,整形old,日期型birthday

m_pConnection->Execute("CREATE TABLE users(ID INTEGER,username TEXT,old INTEGER,birthday DATETIME)",&RecordsAffected,adCmdText);

///往表格里面添加记录

m_pConnection->Execute("INSERT INTO users(ID,username,old,birthday) valueS (1, nullnullnullnullnullnullnullnullWashingtonnullnullnullnullnullnullnullnull,25,nullnullnullnullnullnullnullnull1970/1/1nullnullnullnullnullnullnullnull)",&RecordsAffected,adCmdText);

///将所有记录old字段的值加一

m_pConnection->Execute("UPDATE users SET old = old+1",&RecordsAffected,adCmdText);

///执行SQL统计命令得到包含记录条数的记录集

m_pRecordset = m_pConnection->Execute("SELECT COUNT() FROM users",&RecordsAffected,adCmdText);

_variant_t vIndex = (long)0;

_variant_t vCount = m_pRecordset->GetCollect(vIndex);///取得个字段的值放入vCount变量

m_pRecordset->Close();///关闭记录集

CString message;

message.Format("共有%d条记录",vCount.lVal);

AfxMessageBox(message);///显示当前记录条数

(2)利用Command对象来执行SQL命令

_CommandPtr m_pCommand;

m_pCommand.CreateInstance("ADODB.Command");

_variant_t vNULL;

vNULL.vt = VT_ERROR;

vNULL.scode = DISP_E_PARAMNOTFOUND;///定义为无参数

m_pCommand->ActiveConnection = m_pConnection;///非常关键的一句,将建立的连接赋值给它

m_pCommand->CommandText = "SELECT FROM users";///命令字串

m_pRecordset = m_pCommand->Execute(&vNULL,&vNULL,adCmdText);///执行命令,取得记录集

在这段代码中我们只是用Command对象来执行了SELECT查询语句,Command对象在进行存储过程的调用中能真正体现它的作用。下次我们将详细介绍。

(3)直接用Recordset对象进行查询取得记录集

例如

m_pRecordset->Open("SELECT FROM users",_variant_t((IDispatch )m_pConnection,true),adOpenStatic,adLockOptimistic,adCmdText);

Open方法的原型是这样的:

HRESULT Recordset15::Open ( const _variant_t & Source, const _variant_t & ActiveConnection, enum CursorTypeEnum CursorType, enum LockTypeEnum LockType, long Options )

其中:

①Source是数据查询字符串

②ActiveConnection是已经建立好的连接(我们需要用Connection对象指针来构造一个_variant_t对象)

③CursorType光标类型,它可以是以下值之一,请看这个枚举结构:

enum CursorTypeEnum

{adOpenUnspecified = -1,///不作特别指定

adOpenForwardOnly = 0,///前滚静态光标。这种光标只能向前浏览记录集,比如用MoveNext向前滚动,这种方式可以提高浏览速度。但诸如BookMark,RecordCount,AbsolutePosition,AbsolutePage都不能使用

adOpenKeyset = 1,///采用这种光标的记录集看不到其它用户的新增、删除作,但对于更新原有记录的作对你是可见的。

adOpenDynamic = 2,///动态光标。所有数据库的作都会立即在各用户记录集上反应出来。

adOpenStatic = 3///静态光标。它为你的记录集产生一个静态备份,但其它用户的新增、删除、更新作对你的记录集来说是不可见的。

};

④LockType锁定类型,它可以是以下值之一,请看如下枚举结构:

enum LockTypeEnum

{adLockUnspecified = -1,///未指定

adLockReadOnly = 1,///只读记录集

adLockPessimistic = 2,悲观锁定方式。数据在更新时锁定其它所有动作,这是最安全的锁定机制

adLockOptimistic = 3,乐观锁定方式。只有在你调用Update方法时才锁定记录。在此之前仍然可以做数据的更新、插入、删除等动作

adLockBatchOptimistic = 4,乐观分批更新。编辑时记录不会锁定,更改、插入及删除是在批处理模式下完成。

};

⑤Options请参考本文中对Connection对象的Execute方法的介绍

【5】记录集的遍历、更新

根据我们刚才通过执行SQL命令建立好的users表,它包含四个字段:ID,username,old,birthday

以下的代码实现:打开记录集,遍历所有记录,删除条记录,添加三条记录,移动光标到第二条记录,更改其年龄,保存到数据库。

_variant_t vUsername,vBirthday,vID,vOld;

_RecordsetPtr m_pRecordset;

m_pRecordset.CreateInstance("ADODB.Recordset");

m_pRecordset->Open("SELECT FROM users",_variant_t((IDispatch)m_pConnection,true),adOpenStatic,adLockOptimistic,adCmdText);

while(!m_pRecordset->adoEOF)///这里为什么是adoEOF而不是EOF呢?还记得rename("EOF","adoEOF")这一句吗?

{vID = m_pRecordset->GetCollect(_variant_t((long)0));///取得第1列的值,从0开始计数,你也可以直接给出列的名称,如下一行

vUsername = m_pRecordset->GetCollect("username");///取得username字段的值

vOld = m_pRecordset->GetCollect("old");

vBirthday = m_pRecordset->GetCollect("birthday");

///在DEBUG方式下的OUTPUT窗口输出记录集中的记录

if(vID.vt != VT_NULL && vUsername.vt != VT_NULL && vOld.vt != VT_NULL && vBirthday.vt != VT_NULL)

TRACE("id:%d,姓名:%s,年龄:%d,生日:%srn",vID.lVal,(LPCTSTR)(_bstr_t)vUsername,vOld.lVal,(LPCTSTR)(_bstr_t)vBirthday);

m_pRecordset->MoveNext();///移到下一条记录

}m_pRecordset->MoveFirst();///移到首条记录

m_pRecordset->Delete(adAffectCurrent);///删除当前记录

///添加三条新记录并赋值

for(int i=0;i<3;i++)

{m_pRecordset->AddNew();///添加新记录

m_pRecordset->PutCollect("ID",_variant_t((long)(i+10)));

m_pRecordset->PutCollect("username",_variant_t("叶利钦"));

m_pRecordset->PutCollect("old",_variant_t((long)71));

m_pRecordset->PutCollect("birthday",_variant_t("1930-3-15"));

}m_pRecordset->Move(1,_variant_t((long)adBookmarkFirst));///从条记录往下移动一条记录,即移动到第二条记录处

m_pRecordset->PutCollect(_variant_t("old"),_variant_t((long)45));///修改其年龄

m_pRecordset->Update();///保存到库中

【6】关闭记录集与连接

记录集或连接都可以用Close方法来关闭

m_pRecordset->Close();///关闭记录集

m_pConnection->Close();///关闭连接

至此,我想您已经熟悉了ADO作数据库的大致流程,也许您已经胸有成竹,也许您还有点胡涂,不要紧!建议你尝试写几个例子,这样会更好地熟悉ADO,我给大家写了一个小例子,例子中读出所有记录放到列表控件中、并可以添加、删除、修改记录。

上网查下,分太少

success后面可以加动词原型么?

1、success 是名词,后面不可以加动词原形。

2、success含义

n.(名词)

成功,胜利

成就

成功的事

取得成就的人,成功者

【计】中文网路工作站

中文终端服务系统

好结果,好成绩

考试及格者

得意

一切顺利,一帆风顺

兴隆

3、例句

I am very heartened by her success in the election.

她在竞选中获胜令我大受鼓舞。

He wasn't a success as a teacher.

他不是个好教师。

Success是不可数名词,后面应该加的是动词的第三人称单数形式,或者是系动词"is"。

不可以,success不可数,只有可数名词的复数形式才能加动词原形

success后面不可能加动词原型

success可以专业

success+in doing

版权声明:本文内容由互联。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发 836084111@qq.com 邮箱删除。