Showing posts with label travel around the world. Show all posts
Showing posts with label travel around the world. Show all posts

Saturday, June 23, 2007

Contract translation(English to chinese)

Yesterday,one of my friends ,asked me to translate a contract for him, just becoz he is familiar with Education only, and i m having a job much closer to business.You know it is worth 500,000 US dollars,so i don't know have to help him and i still have to work on my task of project, so i just promised him that if he can not find other guy to help him i can only help him to do the rest of the translation during weekend.And now i am doing it , mostly ,the i had some business english during my collage,but it just for 2months , and did not use it too often, recently.So i have to remind all i learned during the collage.So it bring me back to the collage time,hehehe , so many words familiar."business Invioce" "all risks" "shipping point" "destination point" "contract period" "business days" "calendar days" ................so many things like this, i think it will make me get much of the business aera, though i wrote to my boss, that i will learn business deeply, since it becoz to truth aready and so quickly becoming.hehehe , you have to say , you wish it comes. it is the last weekend here i m in manila,hehe the time and days are under counted before i leave Philippines.Hope everyfriends here got happy.

Thursday, June 21, 2007

How long is your life ---deathclock

Every body just have the life one time , we like to say that Life won't take twice.So you have to take care fo yourself and others , be kindly treat yourself the best enviroment and the mood, it is better for your health and your family.And if you already know how long you still can live ,then wat wil you do first, something
urgent, something necesary. And we remind that the female called Hellen Keller and her famous article <> , i just don't know how to translate it correctly. But it is the same meaning to you , that during your life you just have oneday you can see, then wat you will do ~? you should think of it , it won't take you too much time ,then you will find out wat is the truth healthy and time meaning to you.here , we got the deathclock, according to your information you submitted , it will measure your healthy and then get the supposed result for you, and then , you can see how long is your life will be , and how much time you still have, and the time keeping on deducting , and time gone 1 second by 1sencon. hows your feeling , don't tell others, just ask yourself, wat have you done and wat you achived and wat you have donated? then wat else~?~?you got it ! deathclock


add your web url into search engine(google,yahoo,msn,msn live...

This summary is not available. Please click here to view the post.

Wednesday, June 20, 2007

laptop wireless online easily

It has been many times that i have the laptop with Wifi but always have to put it on my knees , it lots of harm and radiative ,so harmful to our healthy.And we still have to go with it.But there's so many cases that one kind provide us the function that we can put our laptop /notebook on it. it goes convinient.see...

Now it is $150 but i think , someone will just buy a cheaper one ,hehe , i m not ask you to buy it , just tell you that there's lots of cases when you are travelling you can choose one of them ,make your trip much convinient and much funny ,easily. I like travel and there's much cases must consider , the hotel ,the ship , the plane, the train, still the taxi, especial you are in the foreign countries it will make you much scear of that encountering the urgent event. it will make you trouble and unhappy.So becareful and take care of your own treasures. I m sure you will be the one who find out whether there's peace place you should payattentoion. In case some of the travellors have encountered the cases that their passports lost , so they have to turn to the ambossors that will provide them the temporary passport to endup their staying in the countries they visiting.It is an awful experience , isn't it~?~?

Tuesday, June 12, 2007

excel application control




 
全面控制 Excel

首先创建 Excel 对象,使用ComObj:

Dim ExcelID as Excel.Application

Set ExcelID as new Excel.Application

1) 显示当前窗口:

ExcelID.Visible := True;

2) 更改 Excel 标题栏:

ExcelID.Caption := '应用程序调用 Microsoft Excel';

3) 添加新工作簿:

ExcelID.WorkBooks.Add;

4) 打开已存在的工作簿:

ExcelID.WorkBooks.Open( 'C:\Excel\Demo.xls' );

5) 设置第2个工作表为活动工作表:

ExcelID.WorkSheets[2].Activate;

或 ExcelID.WorkSheets[ 'Sheet2' ].Activate;

6) 给单元格赋值:

ExcelID.Cells[1,4].Value := '第一行第四列';

7) 设置指定列的宽度(单位:字符个数),以第一列为例:

ExcelID.ActiveSheet.Columns[1].ColumnsWidth := 5;

8) 设置指定行的高度(单位:磅)(1磅=0.035厘米),以第二行为例:

ExcelID.ActiveSheet.Rows[2].RowHeight := 1/0.035; // 1厘米

9) 在第8行之前插入分页符:

ExcelID.WorkSheets[1].Rows[8].PageBreak := 1;

10) 在第8列之前删除分页符:

ExcelID.ActiveSheet.Columns[4].PageBreak := 0;

11) 指定边框线宽度:

ExcelID.ActiveSheet.Range[ 'B3:D4' ].Borders[2].Weight := 3;

1-左 2-右 3-顶 4-底 5-斜( \ ) 6-斜( / )

12) 清除第一行第四列单元格公式:

ExcelID.ActiveSheet.Cells[1,4].ClearContents;

13) 设置第一行字体属性:

ExcelID.ActiveSheet.Rows[1].Font.Name := '隶书';

ExcelID.ActiveSheet.Rows[1].Font.Color := clBlue;

ExcelID.ActiveSheet.Rows[1].Font.Bold := True;

ExcelID.ActiveSheet.Rows[1].Font.UnderLine := True;

14) 进行页面设置:

a.页眉:

ExcelID.ActiveSheet.PageSetup.CenterHeader := '报表演示';

b.页脚:

ExcelID.ActiveSheet.PageSetup.CenterFooter := '第&P页';

c.页眉到顶端边距2cm:

ExcelID.ActiveSheet.PageSetup.HeaderMargin := 2/0.035;

d.页脚到底端边距3cm:

ExcelID.ActiveSheet.PageSetup.HeaderMargin := 3/0.035;

e.顶边距2cm:

ExcelID.ActiveSheet.PageSetup.TopMargin := 2/0.035;

f.底边距2cm:

ExcelID.ActiveSheet.PageSetup.BottomMargin := 2/0.035;

g.左边距2cm:

ExcelID.ActiveSheet.PageSetup.LeftMargin := 2/0.035;

h.右边距2cm:

ExcelID.ActiveSheet.PageSetup.RightMargin := 2/0.035;

i.页面水平居中:

ExcelID.ActiveSheet.PageSetup.CenterHorizontally := 2/0.035;

j.页面垂直居中:

ExcelID.ActiveSheet.PageSetup.CenterVertically := 2/0.035;

k.打印单元格网线:

ExcelID.ActiveSheet.PageSetup.PrintGridLines := True;

15) 拷贝操作:

a.拷贝整个工作表:

ExcelID.ActiveSheet.Used.Range.Copy;

b.拷贝指定区域:

ExcelID.ActiveSheet.Range[ 'A1:E2' ].Copy;

c.从A1位置开始粘贴:

ExcelID.ActiveSheet.Range.[ 'A1' ].PasteSpecial;

d.从文件尾部开始粘贴:

ExcelID.ActiveSheet.Range.PasteSpecial;

16) 插入一行或一列:

a. ExcelID.ActiveSheet.Rows[2].Insert;

b. ExcelID.ActiveSheet.Columns[1].Insert;

17) 删除一行或一列:

a. ExcelID.ActiveSheet.Rows[2].Delete;

b. ExcelID.ActiveSheet.Columns[1].Delete;

18) 打印预览工作表:

ExcelID.ActiveSheet.PrintPreview;

19) 打印输出工作表:

ExcelID.ActiveSheet.PrintOut;

20) 工作表保存:

If not ExcelID.ActiveWorkBook.Saved then

ExcelID.ActiveSheet.PrintPreview

End if

21) 工作表另存为:

ExcelID.SaveAs( 'C:\Excel\Demo1.xls' );

22) 放弃存盘:

ExcelID.ActiveWorkBook.Saved := True;

23) 关闭工作簿:

ExcelID.WorkBooks.Close;

24) 退出 Excel:

ExcelID.Quit;

25) 设置工作表密码:

ExcelID.ActiveSheet.Protect "123", DrawingObjects:=True, Contents:=True, Scenarios:=True

26) EXCEL的显示方式为最大化

ExcelID.Application.WindowState = xlMaximized

27) 工作薄显示方式为最大化

ExcelID.ActiveWindow.WindowState = xlMaximized

28) 设置打开默认工作薄数量

ExcelID.SheetsInNewWorkbook = 3

29) '关闭时是否提示保存(true 保存;false 不保存)

ExcelID.DisplayAlerts = False

30) 设置拆分窗口,及固定行位置

ExcelID.ActiveWindow.SplitRow = 1

ExcelID.ActiveWindow.FreezePanes = True

31) 设置打印时固定打印内容

ExcelID.ActiveSheet.PageSetup.PrintTitleRows = "$1:$1"

32) 设置打印标题

ExcelID.ActiveSheet.PageSetup.PrintTitleColumns = ""

33) 设置显示方式(分页方式显示)

ExcelID.ActiveWindow.View = xlPageBreakPreview

34) 设置显示比例

ExcelID.ActiveWindow.Zoom = 100

35) 让Excel 响应 DDE 请求

Ex.Application.IgnoreRemoteRequests = False



用VB操作EXCEL

Private Sub Command3_Click()

On Error GoTo err1

Dim i As Long

Dim j As Long

Dim objExl As Excel.Application '声明对象变量

Me.MousePointer = 11 '改变鼠标样式

Set objExl = New Excel.Application '初始化对象变量

objExl.SheetsInNewWorkbook = 1 '将新建的工作薄数量设为1

objExl.Workbooks.Add '增加一个工作薄

objExl.Sheets(objExl.Sheets.Count).Name = "book1" '修改工作薄名称

objExl.Sheets.Add , objExl.Sheets("book1") ‘增加第二个工作薄在第一个之后

objExl.Sheets(objExl.Sheets.Count).Name = "book2"

objExl.Sheets.Add , objExl.Sheets("book2") ‘增加第三个工作薄在第二个之后

objExl.Sheets(objExl.Sheets.Count).Name = "book3"



objExl.Sheets("book1").Select '选中工作薄

For i = 1 To 50 '循环写入数据

For j = 1 To 5

If i = 1 Then

objExl.Selection.NumberFormatLocal = "@" '设置格式为文本

objExl.Cells(i, j) = " E " & i & j

Else

objExl.Cells(i, j) = i & j

End If

Next

Next



objExl.Rows("1:1").Select '选中第一行

objExl.Selection.Font.Bold = True '设为粗体

objExl.Selection.Font.Size = 24 '设置字体大小

objExl.Cells.EntireColumn.AutoFit '自动调整列宽

objExl.ActiveWindow.SplitRow = 1 '拆分第一行

objExl.ActiveWindow. SplitColumn = 0 '拆分列

objExl.ActiveWindow.FreezePanes = True '固定拆分 objExl.ActiveSheet.PageSetup.PrintTitleRows = "$1:$1" '设置打印固定行

objExl.ActiveSheet.PageSetup.PrintTitleColumns = "" '打印标题 objExl.ActiveSheet.PageSetup.RightFooter = "打印时间: " & _

Format(Now, "yyyy年mm月dd日 hh:MM:ss")

objExl.ActiveWindow.View = xlPageBreakPreview '设置显示方式

objExl.ActiveWindow.Zoom = 100 '设置显示大小

'给工作表加密码

objExl.ActiveSheet.Protect "123", DrawingObjects:=True, _

Contents:=True, Scenarios:=True

objExl.Application.IgnoreRemoteRequests = False

objExl.Visible = True '使EXCEL可见

objExl.Application.WindowState = xlMaximized 'EXCEL的显示方式为最大化

objExl.ActiveWindow.WindowState = xlMaximized '工作薄显示方式为最大化

objExl.SheetsInNewWorkbook = 3 '将默认新工作薄数量改回3个

Set objExl = Nothing '清除对象

Me.MousePointer = 0 '修改鼠标

Exit Sub

err1:

objExl.SheetsInNewWorkbook = 3

objExl.DisplayAlerts = False '关闭时不提示保存

objExl.Quit '关闭EXCEL

objExl.DisplayAlerts = True '关闭时提示保存

Set objExl = Nothing

Me.MousePointer = 0

End Sub

Sql 2000 procedure

 摘要:本文以SQL Server2000存储过程为例,探讨了存储过程的优点,并以Visual Basic6.0程序设计语言给出了调用存储过程的关键代码。

  关键字:数据库;SQL Server2000;存储过程;应用程序;VB
 
  存储过程

  存储过程是存储在服务器上的一组预编译的Transact-SQL语句,是一种封装重复任务操作的方法,支持用户提供的变量,具有强大的编程功能。它类似于DOS系统中的BAT文件。在BAT文件中,可以包含一组经常执行的命令,这组命令通过BAT文件的执行而被执行。同样的道理,可以把要完成某项任务的许多Transact-SQL语句写在一起,组织成存储过程的形式,通过执行该存储过程就可以完成这项任务。存储过程与BAT文件又有差别,即存储过程已经进行了预编译。

  1、创建存储过程的方法

  在Transact-SQL语言中,创建存储过程可以使用CREATE PROCEDURE语句,其语法形式如下:






CREATE PROC[EDURE] procedure_name[;number]
[{@parameter data_type}[VARYING][=default][OUTPUT]
]],…n]
[WITH{RECOMPILE|ENCRYPTION|RECOMPILE,ENCRYPTION}]
[FOR REPLICATION]
AS sql_statement[…n]

  在上面的CREATE PROCEDURE语句中,方括号"[ ]"中的内容是可选的,花括号"{}"中的内容是必须出现的,不能省略,[,…n]表示前面的参数样式,可以重复出现。竖线"|"表示两边的选项可以任选一个。

  下面分析该语句中各种选项的含义。

  CREATE PROCEDURE是关键字,也可以写成CREATE PROC。

  procedure_name是该存储过程的名称,名称可以是任何符合命名规则的标示符。名称后的[;number]参数表示可以定义一系列的存储过程名称,这些存储过程的数量由number指定。

  参数名称可以使用@parameter data_type来指定。在Transact-SQL语言中,用户定义的参数名称前面加"@"符号,这些数据类型是Transact-SQL语言允许的各种数据类型,包括系统提供的数据类型和用户定义的数据类型。

  当参数类型为cursor时,必须使用关键字VARYING和OUTPUT。VARYING表示结果集可以是一个输出参数,其内容是动态的。该关键字只能在使用游标作为数据类型时使用。关键字OUTPUT表示这是一个输出参数,可以把存储过程执行的结果信息返回应用程序。
default用于指定参数的默认值。

  RECOMPILE选项表示重新编译该存储过程。该选项只是在需要的时候才使用,例如经常需要改变数据库模式时。

  ENCRYPTION选项用来加密创建存储过程的文本,防止他人查看。

  选项FOR REPLICATION主要用于复制过程中。注意,该选项不能和选项RECOMPILE同时使用。

  AS是一个关键字,表示其后的内容是存储过程的语句。参数sql-statement[…n]表示在一个存储过程中可以包含多个Transact-SQL语句。

  2、存储过程的优点

  在频繁访问数据库的系统中,开发者都乐于使用存储过程,这与存储过程的下列优点是分不开的。

  ⑴ 存储过程可以与其他应用程序共享应用程序的逻辑,从而确保一致的数据访问和操纵。

  ⑵ 存储过程提供了一种安全机制。如果用户被授予执行存储过程权限,那么即使该用户没有访问在执行该存储过程中所参考的表或视图的权限,该用户也可以完全执行该存储过程而不受到影响。因此,可以创建存储过程来完成所有的增加、删除等操作,并且可以通过编程控制上述操作中对信息的访问权限。

  ⑶ 存储过程执行速度快,便于提高系统的性能。由于存储过程在第一次执行之后,其执行规划就驻存在过程高速缓冲存储区中,在以后的操作中,只需从过程高速缓冲存储区中调用编译好的二进制形式存储过程来执行。

  ⑷ 使用存储过程可以减少网络传输时间。如果有一千条Transact-SQL语句的命令,一条一条地通过网络在客户机和服务器之间传送,那么这种传输所耗费的时间将很长。但是,如果把这一千条Transact-SQL语句的命令写成一条较为复杂的存储过程命令,这时在客户机和服务器之间网络传输所需的时间就会大大减少。

  SQL Server 2000数据库存储过程的调用

  VB作为当今应用极为普遍的数据库客户端开发工具之一,对客户端应用程序调用服务器端存储过程提供了强大的支持。特别是随着VB6.0的推出,VB客户端应用程序可以方便地利用ADO的对象和集合来实现对数据库存储过程的调用。

  在笔者编写的科技档案管理系统中,就是采用VB作为开发平台,采用SQL Server2000数据库管理数据,在这个科技档案管理系统中有海量的数据,并且对数据库有频繁的访问,利用存储过程访问数据库节省了执行时间,大大提高了系统的性能。

  1、ADO简介

  ADO控件(也称为ADO Data控件)与VB固有的Data控件相似。使用ADO Data控件,可以利用Microsoft ActiveX Data Objects(ADO)快速建立数据库绑定控件和数据提供者之间的连接。

  ADO Data控件可以实现以下功能:

  ·连接一个本地数据库或远程数据库。

  ·打开一个指定的数据库表,或定义一个基于结构化查询语言(SQL)的查询、存储过程或该数据库中的表的视图的记录集合。

  ·将数据字段的数值传递给数据绑定控件,可以在这些控件中显示或更改这些数值。

  ·添加新的记录,或根据更改显示在绑定的控件中的数据来更新一个数据库。

  2、数据库的连接

  数据库的连接可通过ADO控件实现,为此,必须在工程部件中选择Microsoft ADO Data Control 6.0 (OLEDB),然后在窗体中添加ADO控件。利用ADO连接数据库有两种方法,具体如下。

  1) 通过ADODC属性页实现连接

  在ADODC属性页中选择生成按钮,进入数据链接属性对话框;然后选择该对话框中的连接属性页,选择或输入服务器名称和数据库等重要信息;最后测试连接,连接成功后,按确定按钮,返回到属性页对话框,可获得连接字符串,如下例:






Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=Science_File;Data Source=Data_Server

  其中sa是用户名;Science_File是数据库名;Data_Server是数据库名。

  通过下列语句,即可连接到指定的数据库:





dim odbcstr as String, adocon As New ADODB.Connection
odbcstr = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=Science_File;Data Source=Data_Server"
adocon.Open odbcstr '连接到数据库

  2) 直接使用连接语句实现

  连接数据库的语句如下:






Dim ado as ADODC
ado.ConnectionString = "Provider=SQLOLEDB.1;Password=" & User_Pwd & ";Persist Security Info=True;User ID=" & User_Name & ";Initial Catalog=" & Data_Name & ";Data Source=" & server_name

  其中User-Pwd是用户密码;User_Name是用户名;Data_Name是数据库名;server_name是服务器名。

  连接数据库成功后就可以调用存储过程执行操作。

  3、存储过程的调用

  假设有一个名为doc_ProcName存储过程,该存储过程有一个输入参数,一个输出参数。

  1) 直接传递参数调用存储过程

  直接传递参数方法主要通过以下几个步骤来实现:

  (1) 通过ADODB的Connection对象打开与数据源的连接;

  (2) 通过ActiveConnection指定Command对象当前所属的Connection对象;

  (3) 通过CommandText属性设置Command对象的源,即要调用的存储过程;

  (4) 通过CommandType属性确定Command对象的源类型,如果源类型为存储过程CommandType即为adCmdStoredProc;

  (5) 通过Command对象的Parameters集合向所调用的存储过程传递参数,其中对象Parameters(0)为执行存储过程的返回值,返回值为0则执行存储过程成功;

  (6) 通过Eexecute方法执行在 CommandText 属性中指定的存储过程。

  以存储过程doc_ProcName为例,关键代码如下:






Dim strS As String '定义一变量
Dim adoconn As New ADODB.Connection 'Connection 对象代表了打开与数据源的连接。
Dim adocomm As New ADODB.Command 'Command 对象定义了将对数据源执行的指定命令。
Dim ReturnValue As Integer '调用存储过程的返回值
adoconn.ConnectionString = Adodc1.ConnectionString 'Adodc1为窗体中的ADO控件,并已成功连接数据库
adoconn.Open
Set adocomm.ActiveConnection = adoconn '指示指定的 Command对象当前所属的 Connection对象。
adocomm.CommandText = "doc_ProcName" '设置Command对象源。
adocomm.CommandType = adCmdStoredProc '通知提供者CommandText属性有什么,它可能包括Command对象的源类型。设置这个属性优化了该命令的执行。
adocomm.Parameters(1) = "1"
adocomm.Parameters(2) = "OutputParameters" 'OutputParameters可以为任意的字符串或数字
adocomm.Execute
ReturnValue = adocomm.Parameters(0) '存储过程的返回值,返回0则成功执行。
strS = adocomm.Parameters(2) '把存储过程的输出参数的值赋给变量strS

  2) 追加参数法调用存储过程

  追加参数通过CreateParameter方法,用来指定属性创建新的Parameter对象。具体语法如下:






Set parameter = command.CreateParameter (Name, Type, Direction, Size, Value)

  ·Name 可选,字符串,代表 Parameter 对象名称。
  ·Type 可选,长整型值,指定 Parameter 对象数据类型。
  ·Direction 可选,长整型值,指定 Parameter 对象类型。
  ·Size 可选,长整型值,指定参数值最大长度(以字符或字节数为单位)。
  ·Value 可选,变体型,指定 Parameter 对象值。

  这种方法与上面一种方法的分别主要在于,追加参数的方法在向存储过程传递参数时,这种方法首先通过CreateParameter方法为存储过程创建参数,然后通过Append方法将创建的参数追加到Parameters集合中去。

  仍然以存储过程doc_ProcName的调用为例,关键代码如下:





Dim mRst As ADODB.Recordset 'Recordset 对象表示的是来自基本表或命令执行结果的记录全集。
Dim prm As ADODB.Parameter 'Parameter 对象代表参数或与基于参数化查询或存储过程的Command 对象相关联的参数。
adoconn.ConnectionString = Adodc1.ConnectionString
adoconn.Open
Set adocomm.ActiveConnection = adoconn
adocomm.CommandText = "doc_ProcName"
adocomm.CommandType = adCmdStoredProc
Set prm = adocomm.CreateParameter("parameter1", adTinyInt, adParamInput, , "1")
adocomm.Parameters.Append prm
Set prm = adocomm.CreateParameter("parameter2", adInteger, adParamOutput)
adocomm.Parameters.Append prm
Set mRst = adocomm.Execute
ReturnValue = adocomm.Parameters(0)

  以上代码中未定义的变量以及未注释的语句与前述相同。

  结束语

  在应用程序中调用服务器端存储过程,不仅能显著提高整个应用的性能,而且能加强对数据库数据的保护。VB为客户端应用程序调用存储过程提供了一组方便而有效的方法。