当前位置:文档之家› Borland C++ Builder - SQL

Borland C++ Builder - SQL

Borland C++ Builder - SQL
Borland C++ Builder - SQL

SQL access in Borland C++Builder

Written by Mike Destein. Revised by Charles Gallant.

Outline

1.Introduction

2.TQuery Component

- SQL Property

- Params Property

- Data Source

- Format Command

- Open vs. ExecSQL

3.TStoredProc Component

4.TDatabase

5.Conclusion

1. Introduction

The database components of Borland C++Builder were created with SQL and client/server development in mind. Because of this, you will find extensive support to let you leverage the features of a remote server. C++Builder has implemented this support through two methods. First, the native commands of Borland C++Builder allow the developer to navigate tables, set ranges, delete and insert records, and modify existing records. Second, via pass-through SQL, a string can be passed to a server to be parsed, optimized, and executed, with results returned as appropriate.

This paper focuses on the second method of database access, pass-through SQL. While, it is not intended to be a course on SQL syntax or usage, this paper provides many examples of how to use the TQuery and the TStoredProc components. In doing so, many SQL concepts are presented such as selects, inserts, updates, views, joins, and stored procedures. The paper also introduces transaction control and connecting to a database. To begin, let's create

a simple SELECT query and display the results.

2. TQuery Component

The TQuery and TTable components are both descended from TDataset which provides much of their database access functionality. TDatasource is used to prepare the data for the visual components. Because both the TTable and TQuery components rely on TDatasource, these components have many common traits. For instance, both provide a DatabaseName property through which an alias can be used to specify what server and database a query will access.

SQL Property

The unique functionality of TQuery includes a property titled ‘SQL.’ The SQL property is used to store a SQL statement. The steps below describe how to use a SQL statement to query for all employees who have a salary greater than a specified amount.

1. Drag and drop a TQuery object onto a form.

2. Set the DatabaseName property to an alias. (This example uses IBLOCAL which points to the sample

database EMPLOYEE.GDB.

3. Select the SQL property and click the ‘detail’ button labeled with an ellipsis (“…”). The String List

Editor dialog will appear.

4. Enter Select * from EMPLOYEE where SALARY>50000. Click OK.

5. Select the Active property and set it to “TRUE.”

6. Drag and drop a TDatasource object onto the form.

7. Set the Dataset property of the TDatasource to “Query1.”

8. Drag and drop a TDBGrid onto the form.

9. Set the Datasource property of the TDBGrid to “Datasource1”.

The SQL property is of type TStrings. A TStrings object is a list of strings, similar to an array. The TStrings data type offers commands to add lines, load from a text file, and exchange data with another TStrings object. Another component that uses TStrings is a TMemo. In the following listing, the user would enter the SQL Statement in the ‘Memo1’ TMemo control and click the Do It button. The results of the query can be displayed in a grid.

Listing 1 displays the code in the Do It button.

Listing 1

void __fastcall TForm1::Button1Click(TObject *Sender)

{

// Check for a blank entry.

if (strcmp(Memo1->Lines->Strings[0].c_str(), "") == 0)

{

MessageBox(0, "No SQL Statement Entered", "Error", MB_OK);

return;

}

else

{

// Deactivate the query as a precaution.

Query1->Close();

// Empty any previous query

Query1->SQL->Clear();

// Assign the SQL property the memo's text.

Query1->SQL->Add(Memo1->Lines->Strings[0].c_str());

}

try

{

// Execute the statement and open the dataset

Query1->Open();

}

catch(EDBEngineError* dbError)

{

for (int i = 0; i < dbError->ErrorCount; i++)

{

MessageBox(0, dbError[i].Message.c_str(), "SQL Error", MB_OK);

}

}

}

Params Property

This would suffice for a user who knows SQL. Most users, however, do not. So your job as the developer is to provide an interface and construct the SQL statement. In Borland C++Builder, you can use a dynamic query to construct the SQL statement on the fly. Dynamic queries allow the usage of parameters. To specify a parameter in a query, use a colon (“:”) preceding a parameter name. Below is an example SQL statement using a dynamic parameter:

Select * from EMPLOYEE

where DEPT_NO = :Dept_no

When you want to test or set a default value for the parameter, select the Params property of Query1. Click the '...' button. This presents the parameters dialog. Select the parameter DeptNo. Then select Integer from the data type drop-down list. To set a default, make an entry in the Value edit box.

Bind parameters provide run-time access to modify a SQL statement. The parameters can be changed and the query re-executed to update the data. To directly modify the parameter value, use either the Params property or ParamByName method. The Params property is a pointer to a TParams object. So to access a parameter, you need to access the Item property of the TParams object specifying the index of the Items property. For example, Query1->Params->Items[0]->AsInteger = 900;

or,

Query1->Params->Items[0]->AsInteger = atoi(Edit1->Text.c_str());

The AsInteger property reads the data as an Integer (nicely self documenting). This does not necessarily mean that the field type is an integer. If the field type is ANSIString, C++Builder will do the data conversion. So the above example could have been written as:

Query1->Params->Items[0]->AsString = "900";

or,

Query1->Params->Items[0]->AsString = Edit1->Text;

When you would rather use the parameter name instead of the index number, use the ParamByName method. This method will return the TParam object with the specified name. For example,

Query1->ParamByName("DEPT_NO")->asInteger = 900;

Listing 2 shows a complete example.

Listing 2

void __fastcall TForm1::Button1Click(TObject *Sender)

{

// Deactivate the query.

Query1->Close();

if (! Query1->Prepared)

{

// Make sure the query is prepared;

Query1->Prepare();

// Take the value entered by the user and replace the parameter

// with the value.

if (strcmp(Edit1->Text.c_str(),"") == 0)

{

Query1->ParamByName("DEPT_NO")->AsInteger = 0;

Edit1->Text = 0;

}

else

{

Query1->ParamByName("DEPT_NO")->AsString = Edit1->Text.c_str();

}

// Trap for errors.

try

{

// Execute the statement, and open the dataset.

Query1->Open();

}

catch(EDBEngineError* dbError)

{

for (int i = 0; i < dbError->ErrorCount; i++)

{

MessageBox(0, dbError[i].Message.c_str(), "SQL Error", MB_OK);

}

}

}

}

Notice the procedure first determines if the query is prepared. When the prepare method is called, Borland

C++Builder sends the SQL statement to the remote server. The server will then parse and optimize the query. The benefit of preparing a query is to allow the server to parse and optimize it once. The alternative would be to have the server prepare it each time the query is executed. Once the query is prepared, all that is necessary is to supply new parameter values and execute the query.

Data Source

In the previous example, the user could enter a department number and when the query is executed, a list of employees in that department is displayed. What about using the DEPARTMENT table to help the user scroll through the employees and departments.

Note: The next example has a TTable called Table1. Table1's Databasename is IBLOCAL and the

Tablename is DEPARTMENT. DataSource2 is the TDatasource bound to Table1. The table is also active and displaying records in a TDBGrid.

The way to connect the TQuery to the TTable is through the TDatasource. There are two main techniques to do this. First, place code in the TDatasource's OnDataChange event. For example, Listing 3 demonstrates this technique.

Listing 3 - Using the OnDataChange event to view child records

void __fastcall TForm1::DataSource2DataChange(TObject *Sender,

TField *Field)

{

Query1->Close();

if (!Query1->Prepared)

{

Query1->Prepare();

Query1->ParamByName("Dept_no")->AsInteger = Table1->Fields[0]->AsInteger;

try

{

Query1->Open();

}

catch(EDBEngineError* dbError)

{

for (int i = 0; i < dbError->ErrorCount; i++)

{

MessageBox(0, dbError[i].Message.c_str(), "SQL Error", MB_OK);

}

}

}

}

While the technique of using OnDataChange is very flexible, there is an easier way to connect a query to a table. The TQuery component has a Datasource property. By specifying a TDatasource for the Datasource property, the

TQuery object will compare the parameter names in the SQL statement to the field names in the TDatasource. Where there are common names, those parameters will be filled in automatically. This would release the developer from having to perform the code in Listing 3 above.

In fact, the technique of using the Datasource requires no additional code at all. Perform the steps in listing 4 to connect the query to the table by DEPT_NO.

Listing 4 - Binding a TQuery to a TTable via the Datasource Property With the Query1, select the SQL property and enter:

select * from EMPLOYEE

where DEPT_NO = :DEPT_NO

Select the Datasource property and choose the datasource bound to Table1 (Datasource2 in the sample). Select the Active property and choose TRUE. That's all you need to do for this type of relation. There are some limitations on parameterized queries, however. Parameters are limited to values. You cannot use a parameter for a Column name or Table name for example. To create a query that dynamically modifies the table name, one technique could be to use string concatenation. Another technique is the use the Format command.

sprintf Function (from the C++ RTL)

The sprintf function will replace the format parameter (%s, %d, %n, etc.) with a value passed. For example, sprintf(sqlStr, "select * from %s", "EMPLOYEE");

The result of the above command would be "Select * from EMPLOYEE". The function will do a literal replacement of the format parameter with the arguments . When using multiple format parameters,

replacement is done from left to right. For example,

tblName = "EMPLOYEE";

fldName = "EMP_ID";

fldValue = 3;

sprintf("select * from %s where %s = %d", tblName, fldName, fldValue)

The result of this sprintf function is "Select * from EMPLOYEE where EMP_ID = 3". This functionality provides an extremely flexible approach to dynamic query execution. The example in Listing 5 below lets the user to show the salary field in the result. The user also can enter a criteria for the salary field.

Listing 5 - Using sprintf to create a SQL statement procedure

void __fastcall TForm1::Button1Click(TObject *Sender)

{

// this will be used to hold the SQL Statement.

//

char* sqlStr = new char[250];

// These will be used to pass values to sprintf.

//

char* fmtStr1 = new char[50];

char* fmtStr2 = new char[50];

// If the Salary check box has a check.

//

if (showSalaryChkBox->Checked)

{

strcpy(fmtStr1, ", SALARY");

}

else

{

strcpy(fmtStr1, "");

}

// If the Salary Edit box is not empty

//

if (!(strcmp(salaryEdit->Text.c_str(),"") == 0))

{

strcpy(fmtStr2, salaryEdit->Text.c_str());

}

else

{

strcpy(fmtStr2, "> 0");

}

// Deactivate the query as a precaution.

//

Query1->Close();

// Erase the previous query.

//

Query1->SQL->Clear();

// Build the SQL statement using the sprintf() function.

//

sprintf(sqlStr, "Select EMP_NO %s from EMPLOYEE where SALARY %s", fmtStr1,

fmtStr2);

Query1->SQL->Add(sqlStr);

try

{

Query1->Open();

}

catch(EDBEngineError* dbError)

{

for (int i = 0; i < dbError->ErrorCount; i++)

{

MessageBox(0, dbError[i].Message.c_str(), "SQL Error", MB_OK);

}

}

}

In this example, we are using the Clear and Add methods of the SQL property. Because a prepared query uses resources on the server and there is no guarantee that the new query will use the same tables and columns, Borland C++Builder will unprepare the query any time the SQL property is changed. When a TQuery has not been prepared (i.e. the Prepared property is False), C++Builder will automatically prepare it each time it is executed

Open vs. ExecSQL

In the previous examples, the TQueries performed a Select statement. Borland C++Builder treats the result of the Select query as a Dataset, like a table would. This is just one class of SQL statements that are permissible. For instance, the Update command updates the contents of a record, but does not return records or even a value. When you want to use a query that does not return a dataset, use ExecSQL instead of Open. ExecSQL will pass the statement to the server to be executed. In general, if you expect to get data back from a query, then use Open. Otherwise, it is always permissible to use ExecSQL, although using it with a Select would not be constructive. Listing 6 provides an excerpt from an example.

Listing 6

void __fastcall TForm1::Button1Click(TObject *Sender)

{

// deactivate the query, and clear the current SQL statement.

//

Query1->Close();

Query1->SQL->Clear();

// change the SQL statement to perform an update (which returns

// no dataset).

//

Query1->SQL->Add("update EMPLOYEE set SALARY = (SALARY * (1 + :raise)) where (SALARY

< :salary)");

Query1->ParamByName("salary")->AsString = Edit1->Text.c_str();

Query1->ParamByName("raise")->AsString = Edit2->Text.c_str();

// execute the new SQL statement.

//

try

{

Query1->ExecSQL();

}

catch(EDBEngineError* dbError)

{

for (int i = 0; i < dbError->ErrorCount; i++)

{

MessageBox(0, dbError[i].Message.c_str(), "SQL Error", MB_OK);

}

}

// deactivate the query, and set the SQL statement back to the

// original SQL statement.

//

Query1->Close();

Query1->SQL->Clear();

Query1->SQL->Add("select * from EMPLOYEE");

// open the Query.

//

try

{

Query1->Open();

}

catch(EDBEngineError* dbError)

{

for (int i = 0; i < dbError->ErrorCount; i++)

{

MessageBox(0, dbError[i].Message.c_str(), "SQL Error", MB_OK);

}

}

}

The examples provided here only introduce the subject of using queries in your application. They should give you a good foundation to begin using TQueries in your applications. SQL servers offer additional features including stored procedures and transactions. The next two sections briefly introduce some of these features.

3. TStoredProc Component

A stored procedure is a listing of SQL, or server-specific, commands stored and executed on the server. Stored procedures are not much different in concept than other kinds of procedures. The TStoredProc is descended from TDataset so it will share many traits with the TTable and TQuery. The similarity to a TQuery is especially noticeable. Since stored procedures aren't required to return a value, the same rules apply for the ExecProc and Open methods. Each server will implement stored procedure usage a little differently. For example, if you are using Interbase as the server, stored procedures are executed via Select statements. To view the result of the stored procedure, ORG_CHART, in the example EMPLOYEE database use the following SQL statement: Select * from

ORG_CHART

With other servers such as Sybase, you can use the TStoredProc component. This component has properties for Databasename and the name of the stored procedure. If the procedure takes any parameters, use the Params property to input values.

4. TDatabase

The TDatabase component provides functionality in addition to that of the TQuery and TStoredProc component. Specifically, a TDatabase allows the application to create a BDE alias local to the application thus not requiring an alias to be present in the BDE Configuration file. This local alias can be used by all TTables, TQueries, and TStoredProcs in the application. The TDatabase also allows the developer to customize the login process by suppressing the login prompt or filling in parameters as necessary. Lastly and most importantly, a TDatabase can keep a single connection to a database funneling all database operations through one component. This allows the database controls to support transactions.

A transaction can be thought of as a unit of work. The classic example of a transaction is a bank account transfer. The transaction would consist of adding the transfer amount to the new account and deleting that amount from the original account. If either one of those steps fails, the entire transfer is incomplete. SQL servers allow you to rollback commands if an error occurs, never making the changes to the database. Transaction control is a function of the TDatabase component. Since a transaction usually consists of more that one statement, you have to mark the beginning of a transaction and the end. To mark the beginning of a transaction, use TDatabase->StartTransaction() . Once a transaction has begun, all commands executed are in a temporary state until either TDatabase->Commit() or TDatabase->Rollback() is called. If Commit is called, any changes made to the data are posted. If Rollback is called, any changes are discarded. The example in Listing 7 below uses the PHONE_LIST table. The function shown will change the location of the office that was entered in the EditOldLocation TEdit control to the location entered in the EditNewLocation TEdit control.

Listing 7

void __fastcall TForm1::Button1Click(TObject *Sender)

{

try

{

// this will be used to hold the SQL Statement.

//

char sqlStr[250];

Database1->StartTransaction();

Query1->SQL->Clear();

// change Location of the office that was entered

// into EditOldLocation to the value entered into

// EditNewLocation.

//

sprintf(sqlStr, "update PHONE_LIST set LOCATION = \"%s\" where (LOCATION = \"%s\")", EditNewLocation->Text.c_str(), EditOldLocation->Text.c_str());

Query1->SQL->Add(sqlStr);

Query1->ExecSQL();

Query1->SQL->Clear();

// change Location of the office that was entered

// into EditNewLocation to the value entered into

// EditOldLocation.

//

sprintf(sqlStr, "update PHONE_LIST set LOCATION = \"%s\" where (LOCATION = \"%s\")", EditOldLocation->Text.c_str(), EditNewLocation->Text.c_str());

Query1->ExecSQL();

// commit all changes made to this point.

//

DataBase1->Commit();

Table1->Refresh();

Table2->Refresh();

}

catch(EDBEngineError* dbError)

{

for (int i = 0; i < dbError->ErrorCount; i++)

{

MessageBox(0, dbError[i].Message.c_str(), "SQL Error", MB_OK);

}

Database1->Rollback();

return;

}

catch (Exception* exception)

{

MessageBox(0, exception->Message.c_str(), "Error", MB_OK);

Database1->Rollback();

return;

}

}

The last step necessary is connecting to the database. In the example above, a TDatabase was used to provide the single conduit to the database, thus allowing a single transaction. To accomplish this, an Aliasname was specified. The alias holds the connection information such as Driver Type, Server Name, and User Name. This information is used to create a connect string. To create an alias, you can use the BDE Config utility or, as the next example shows, you can fill in parameters at runtime.

The TDatabase component provides a Params property that stores connection information. Each row in the Params property is a separate parameter. In the example below, the user puts their User Name in Edit1 and the Password in Edit2. To connect to the database, the code in Listing 8 is executed:

Listing 8

void __fastcall TForm1::Button1Click(TObject *Sender)

{

try

{

// create two buffers, one for user name,

// and the other for password entries.

//

char* nameStr = new char[20];

char* passStr = new char[20];

//Close the Database, and set the params.

//

Database1->Close();

Database1->DriverName = "INTRBASE";

Database1->KeepConnection = true;

Database1->LoginPrompt = false;

Database1->Params->Add("SERVER NAME=d:\\ebony\\IntrBase\\EXAMPLES\\EMPLOYEE.GDB");

Database1->Params->Add("SCHEMA CACHE=8");

Database1->Params->Add("OPEN MODE=READ/WRITE");

Database1->Params->Add("SQLPASSTHRU MODE=SHARED NOAUTOCOMMIT");

sprintf(nameStr, "USER NAME=%s", Edit1->Text.c_str());

Database1->Params->Add(nameStr);

sprintf(passStr, "PASSWORD=%s", Edit2->Text.c_str());

Database1->Params->Add(passStr);

// Re-Open the Database, and re-open the Table

//

Database1->Open();

Table1->Open();

// Fill a ComboBox with the names of the tables in the

// Database.

//

Database1->Session->GetTableNames(Database1->DatabaseName, "*",

true,

true,

ComboBox1->Items);

}

catch(EDBEngineError* dbError)

{

for (int i = 0; i < dbError->ErrorCount; i++)

{

MessageBox(0, dbError[i].Message.c_str(), "Error", MB_OK);

}

}

}

This example shows how to connect to a server without creating an alias. The key points are to specify a DriverName and fill out the Params with the necessary information to connect. You don't need to specify all the parameters, you just need to specify those that are not set with the driver in the BDE Configuration. Making an entry in the Params property will override any settings in BDE Configuration. By omitting a parameter, C++Builder will fill in the rest of the parameters with the settings in the BDE configuration. The example above also introduces the new concepts of sessions and the GetTableNames method. The session variable is a handle to the database engine and is discussed further in your Borland C++Builder documentation.

One other point to be made is the use of SQLPASSTHRU MODE. This parameter of a database determines how native database commands such as TTable.Append and TTable.Insert will interact with TQueries connected to the same database. There are three possible values: NOT SHARED, SHARED NOAUTOCOMMIT, and SHARED AUTOCOMMIT. NOT SHARED means that native commands are using one connection to the server and the queries are using another connection. The server sees this as two different users effectively. Any time that a transaction is active, native commands are not committed until that transaction is posted. If a TQuery is executed, any changes it might make are posted to the database, separate from the transaction.

The other two modes SHARED NOAUTOCOMMIT and SHARED AUTOCOMMIT. AUTOCOMMIT will share the same connection to the server with the native commands and queries. The difference between the two is whether native commands are automatically committed upon execution. If SHARED AUTOCOMMIT is the selected mode, then it would be pointless to begin a transaction that uses native commands to delete a record and then try to issue Rollback. The record would be deleted and the change would be committed prior to the Rollback command. If you need to issue native commands within a transaction and have those commands included with the transaction, make sure the SQLPASSTHRU MODE is set to SHARED NOAUTOCOMMIT or NOT SHARED.

4. Conclusion

C++Builder provides many services to use the SQL language with your database servers. At this point, you should have a good framework to begin using SQL in your C++Builder applications.

Copyright ? 1996. Borland International, Inc.

C++ builder 中关于窗体的一些操作

C++ builder 中关于窗体的一些操作(总在最前,遍历控件...) 一、让窗口总是在最前面 Form 的FormStyle属性设置为fsStayOnTop值。 二、动态调用窗体Form 在缺省情况下,由File/New Form生成添加入项目文件中的窗体都具有"Auto Create"(自动创建)的特性。即只要程序运行,该窗体就存在于内存中了,不管当前它是否被调用。具有这种特性的窗体一般适用于窗体属性比较固定、经常被调用的情况。其优点是速度快,缺点是占用内存。在实际程序设计中,会遇见大量类似对话框功能的窗体,它们用于显示状态或输入信息,仅须在程序中调用一下,完成其功能就行了,无需常驻内存。这时可以通过选择Project/Options/Forms,将"Auto--Create forms " 栏中相应的窗体, 如Form1,用" >" 键移动到"Available forms"栏中,并在程序需调用该窗体处,加入下列语句:TForm1 *myform=new TForm1(this); myform- >ShowModal(); delete myform; 窗体Form1仅是在需要调用时才调入内存,调用完成后,即用delete清除出内存。这样可减少程序对内存资源的占用。 三、遍历窗体控件的方法 要访问或修改窗体上的控件,方法很简单,以TEdit为例子: Edit1- >Text=""; Edit2- >Text=""; 但如果窗体上有十来个像Edit1 这样的控件,需要进行相同的初始化,用上面的方法一个一个地进行,岂不麻烦!所以有必要掌握遍历窗体控件的方法。在介绍该方法之前,让我们先了解一下窗体Form 的Components 和Controls 属性。参见表一。

15个常用的Excel函数公式

15 个常用的Excel函数公式,拿来即用1、查找重复内容 =IF(COUNTIF(A:A,A2)>1," 重复","") 2、重复内容首次出现时不提示 =IF(COUNTIF(A$2:A2,A2)>1," 重复","") 3、重复内容首次出现时提示重复 =IF(COUNTIF(A2:A99,A2)>1," 重复","")

4、根据出生年月计算年龄 =DATEDIF(A2,TODAY(),"y") 5、根据身份证号码提取出生年月 =--TEXT(MID(A2,7,8),"0-00- 00") 6、根据身份证号码提取性别 =IF(MOD(MID(A2,15,3),2)," 男"," 女") 7、几个常用的汇总公式 A列求和:=SUM(A:A)

A列最小值: =MIN(A:A) A列最大值: =MAX (A:A) A列平均值: =AVERAGE(A:A) A列数值个数: =COUNT(A:A) 8、成绩排名 =RANK.EQ(A2,A$2:A$7) 9、中国式排名(相同成绩不占用名次) =SUMPRODUCT((B$2:B$7>B2)/COUNTIF(B$2:B$7,B$2:B$7))+1 10、90 分以上的人数

=COUNTIF(B1:B7,">90") 11、各分数段的人数 同时选中 E2:E5,输入以下公式,按 Shift+Ctrl+Enter =FREQUENCY(B2:B7,{70;80;90}) 12、按条件统计平均值 =AVERAGEIF(B2:B7,"男",C2:C7) 13、多条件统计平均值 =AVERAGEIFS(D2:D7,C2:C7,男"",B2:B7," 销售")

VB控件属性大全

1.01、窗体(FORM)的常用属性 属性说明 (Name)窗体的名称 ActiveControl返回焦点所在的控件,该属性设计阶段不可用,运行时只读。 Appearance 外观效果,取值为: 0 平面 1 3D(立体) AutoRedraw 是否自动刷新或重画窗体上所有图形[获得或设置从绘图(graphics)方法到一个持久性位图的输出],取值为: True False BackColor背景颜色,可从弹出的调色板选择。 BorderStyle 设置边界类型,取值为: 0 None(无边界框架) 1 FixedSingle(窗口大小固定不变的单线框架) 2 Sizable(窗口大小可变的标准双线框架) 3 FixedDialog(窗口大小固定的对话框窗体) 4 FixedToolWindow(窗口大小固定的工具箱窗体) 5 Sizable ToolWindow(窗口大小可变的工具箱窗体) Caption窗体的标题 ClipControls 决定Paint事件的graphics方法是重画整个对象,还是重画新显示的区域。取值为: True或False ControlBox 是或有控制框, 取值为:True 有 False 无 DrawMode 设定窗体上绘图(graphics方法),Shape,Line等控件的输出外观,有16种可选: 1 黑色 2 非或笔,设置值15的反相 3 与非笔,背景色以及画笔反相二者共有颜色的组合 4 非复制笔,设置值13的反相 5 与笔非,画笔以及显示色反相二者共有颜色的组合 6 反相,显示颜色反相 7 异或笔,画笔颜色以及显示颜色的异或 8 非与笔,设置值9的反相 9 与笔,画笔以及显示色二者共有颜色的组合

最常用函数公式大全

Excel函数公式大全工作中最常用Excel函数公式大全 一、数字处理 1、取绝对值 =ABS(数字) 2、取整 =INT(数字) 3、四舍五入 =ROUND(数字,小数位数) 二、判断公式 1、把公式产生的错误值显示为空 公式:C2 =IFERROR(A2/B2,"") 说明:如果是错误值则显示为空,否则正常显示。 ? 2、IF多条件判断返回值 公式:C2 =IF(AND(A2<500,B2="未到期"),"补款","") 说明:两个条件同时成立用AND,任一个成立用OR函数.

? 三、统计公式 1、统计两个表格重复的内容 公式:B2 =COUNTIF(Sheet15!A:A,A2) 说明:如果返回值大于0说明在另一个表中存在,0则不存在。 ? 2、统计不重复的总人数 公式:C2 =SUMPRODUCT(1/COUNTIF(A2:A8,A2:A8)) 说明:用COUNTIF统计出每人的出现次数,用1除的方式把出现次数变成分母,然后相加。

? 四、求和公式 1、隔列求和 公式:H3 =SUMIF($A$2:$G$2,H$2,A3:G3) 或 =SUMPRODUCT((MOD(COLUMN(B3:G3),2)=0)*B3:G3) 说明:如果标题行没有规则用第2个公式 ? 2、单条件求和 公式:F2 =SUMIF(A:A,E2,C:C) 说明:SUMIF函数的基本用法

? 3、单条件模糊求和 公式:详见下图 说明:如果需要进行模糊求和,就需要掌握通配符的使用,其中星号是表示任意多个字符,如"*A*"就表示a前和后有任意多个字符,即包含A。 ? 4、多条件模糊求和 公式:C11 =SUMIFS(C2:C7,A2:A7,A11&"*",B2:B7,B11) 说明:在sumifs中可以使用通配符*

C#控件属性大全

Control类中定义的基础控件属如下(注意属性名称并不完全一致): 1.AllowDrop属性:以确定控件是否接受用户的拖动。如果允许其属性值为true,否我false(默认值)。对于 RichTextBox控件,本属性中是为false。 2.Anchor属性:获取或设置控件是男个边缘停靠在容器的边缘。本属性的值为AnchorStyles枚举值之一。 3.BackColor属性:以获取或设置本控件的背景颜色。本属性为环境属性,因此中是返回非空值。 4.BackgroundImage属性:以获取或设置控件中显示的背景图片。 5.BindingContext属性:以获取或设置对象的BindingContext。控件BindingContext对象用于为其中包含的所有数据绑定控件返回一个BindingManagerBese对象。BindingManagerBase对象使绑定到同一数据源的所有控件保持同步。例如:设置该对象Position属性,可以指定所有数据绑定控件指向的底层类表现。(不懂用到再说,宽宽心里方不下啊)。 6.Bottom属性:以获取本控件下边缘以容器客户区上边缘之间的距离。本属性的值等于Top属性与Height属性值只和。 7.Bounds属性:以获取或设置本控件的边界矩形。 8.CanFocus属性:以确定控件是否能接收焦点。如能,其值为true,否则为false。要使控件能接收输入焦点,控件必须具有句柄,并且Visible和Enabled属性必须为true。 9.CanSelect属性:以确定本控件是否可被选择。如可以其值为true,否则为false。如果控件的ControlStyles.Selectable被设置为true,并且它的容器控件和所有的父控件都可见并且被启用,这本属性将返回true。下面给出的CanSelect属性为false的windows窗体控件:Panel、GroupBox、PictureBox、ProgressBar、Splitter、Label、LinkLabel(当控件不存在连接时)。需要注意的是,派生自这些控件的控件也不能被选择。 10.Capture属性:以确定控件是否被鼠标捕获。如是值为true,否值为false (默认)。如true,它将接受鼠标的输入,而无论光标是否处于它的边界内。

15个常用的Excel函数公式

15个常用的Excel函数公式,拿来即用 1、查找重复内容 =IF(COUNTIF(A:A,A2)>1,"重复","") 2、重复内容首次出现时不提示 =IF(COUNTIF(A$2:A2,A2)>1,"重复","") 3、重复内容首次出现时提示重复 =IF(COUNTIF(A2:A99,A2)>1,"重复","")

4、根据出生年月计算年龄 =DATEDIF(A2,TODAY(),"y") 5、根据身份证号码提取出生年月 =--TEXT(MID(A2,7,8),"0-00-00") 6、根据身份证号码提取性别 =IF(MOD(MID(A2,15,3),2),"男","女") 7、几个常用的汇总公式 A列求和:=SUM(A:A)

A列最小值:=MIN(A:A) A列最大值:=MAX (A:A) A列平均值:=AVERAGE(A:A) A列数值个数:=COUNT(A:A) 8、成绩排名 =RANK.EQ(A2,A$2:A$7) 9、中国式排名(相同成绩不占用名次) =SUMPRODUCT((B$2:B$7>B2)/COUNTIF(B$2:B$7,B$2:B$7))+1 10、90分以上的人数

=COUNTIF(B1:B7,">90") 11、各分数段的人数 同时选中E2:E5,输入以下公式,按Shift+Ctrl+Enter =FREQUENCY(B2:B7,{70;80;90}) 12、按条件统计平均值 =AVERAGEIF(B2:B7,"男",C2:C7) 13、多条件统计平均值 =AVERAGEIFS(D2:D7,C2:C7,"男",B2:B7,"销售")

所有控件都具有的属性

所有控件都具有的属性:1、Name: 表示在代码中用来标识一个控件的名字。 2、Enabled: 表示一个控件是否可以响应一个事件,即该控件可不可用。 值为true: 可以响应;值为false: 不可以看见。 3、Visible: 表示一个控件是否可见。值为true:可以看见;值为false: 不可以看见。 所有控件都具有的事件:1、KeyDown : 当用户按下键盘上一个键时发生的。 2、KeyUp : 在用户松开键盘上按下的键时发生的。 3、KeyPress : 在Key Down和Key Up事件之间发生。 4、MouseDown : 在鼠标被按下时触发的。 5、MouseUp :在用户松开鼠标键时发生的。 6、Click :在用户单击鼠标左键时发生的。 7、DblClick :在用户双击鼠标时发生的。 一、窗体 (Form)属性: 1、Caption: 表示窗体标题栏的文字。 2、BorderStyle: 一般情况下为默认值,若更改为下列值: 1)值为0:没有窗体标题栏 2)值为1:窗体运行之后不能改变大小 3、WindowState: 设置窗体的大小。 3)值为0:窗体正常大小 4)值为1:窗体最小化值为2:窗体最大化 4、BackColor: 表示窗体的背景颜色 事件 1、Initialize(初始化事件): 在窗体加载和显示之前触发,这个事件只触一次。 2、Load(加载事件): 用来完成窗体显示之前需要完成的动作。 3、Activate/Deactivate (激活/非激活事件):是用户在同一个应用程序的两个或多个窗体之间移动时触发的。 4、QueryUnload(条件卸载事件): 决定窗体是如何关闭的。 触发QueryUnload事件时Unload 的参数和因素有: 1)VbFormControlMenu值为0 :选中窗体控件菜单中的Close命令。 2)VbFormCode值为1 :从代码中调用Unload 语句。 3)VbAppWindows值为2 :终止当前的Windows操作系统。 4)VbFormMDIForm值为4 :因为终止MDI父窗体而导致MDI子窗体的终止。 5、Terminate(终止事件):在窗体的所有实例从内存中清除时发生,只触发一次。 方法: 1、Load:加载窗体,但不在屏幕上显示 2、Unload:卸载窗体,既从屏幕上也从内存中清除窗体。 3、Show:加载窗体并在屏幕上显示窗体。Show分为: 1)正常窗体:Form1.show 2)模式窗体(只能显示一个窗体):Form1.show.vbmodel 4、Hide:从屏幕上隐藏窗体,但是在内存中保存窗体的信息。 5、Move:移动窗体,必须有坐标值。 二、文本框(Text)属性: 1、Text:表示文本框里的文本。如:Text1.Text=”APPLE” 2、MaxLength:给定一个整数,表示文本框最多可以输入几个字符(英文与汉字长度一样,都占一个字节)。 3、PasswordChar: 显示密码时使用。 4、Locked: 值为True: 用户不可以编辑文本框中的文本。 False:文本框中的文本可以更改。 5、MultiLine: 值为True:文本可以显示在多行。 False:文本只能显示在一行。 6、BackColor:文本框的背景颜色。 7、BorderStyle:设置文本框的样式,有两个值(上机试一下)。 8、Font:设置文本中的字体。 9、ForeColor:设置文本框中字体的颜色。 事件 1、Click:点击文本框时发生。 2、Change:当文本框中的文本发生变化时发生。 3、LostFocus:当文本框失去焦点时发生。

工作中最常用的excel函数公式大全

工作中最常用的excel函数公式大全 一、数字处理 1、取绝对值=ABS(数字) 2、取整=INT(数字) 3、四舍五入=ROUND(数字,小数位数) 二、判断公式 1、把公式产生的错误值显示为空 公式:C2=IFERROR(A2/B2,"") 说明:如果是错误值则显示为空,否则正常显示。 2、IF多条件判断返回值公式: C2=IF(AND(A2<500,B2="未到期"),"补款","") 说明:两个条件同时成立用AND,任一个成立用OR函数。

1、统计两个表格重复的内容 公式:B2=COUNTIF(Sheet15!A:A,A2) 说明:如果返回值大于0说明在另一个表中存在,0则不存在。 2、统计不重复的总人数 公式:C2=SUMPRODUCT(1/COUNTIF(A2:A8,A2:A8)) 说明:用COUNTIF统计出每人的出现次数,用1除的方式把出现次数变成分母,然后相加。

1、隔列求和 公式:H3=SUMIF($A$2:$G$2,H$2,A3:G3) 或=SUMPRODUCT((MOD(COLUMN(B3:G3),2)=0)*B3:G3) 说明:如果标题行没有规则用第2个公式 2、单条件求和 公式:F2=SUMIF(A:A,E2,C:C) 说明:SUMIF函数的基本用法

3、单条件模糊求和 公式:详见下图 说明:如果需要进行模糊求和,就需要掌握通配符的使用,其中星号是表示任意多个字符,如"*A*"就表示a前和后有任意多个字符,即包含A。 4、多条件模糊求和 公式:C11=SUMIFS(C2:C7,A2:A7,A11&"*",B2:B7,B11) 说明:在sumifs中可以使用通配符*

数据库常用函数

数据库常用函数

一、基础 1、说明:创建数据库 CREATE DATABASE database-name 2、说明:删除数据库 drop database dbname 3、说明:备份和还原 备份:exp dsscount/sa@dsscount owner=dsscount file=C:\dsscount_data_backup\dsscount.dmp log=C:\dsscount_data_backup\outputa.log 还原:imp dsscount/sa@dsscount file=C:\dsscount_data_backup\dsscount.dmp full=y ignore=y log=C:\dsscount_data_backup\dsscount.log statistics=none 4、说明:创建新表 create table tabname(col1 type1 [not null] [primary key],col2 type2 [not null],..) CREATE TABLE ceshi(id INT not null identity(1,1) PRIMARY KEY,NAME VARCHAR(50),age INT) id为主键,不为空,自增长 根据已有的表创建新表: A:create table tab_new like tab_old (使用旧表创建新表) B:create table tab_new as select col1,col2… from tab_old definition only 5、说明:删除新表 drop table tabname 6、说明:增加一个列 Alter table tabname add column col type 注:列增加后将不能删除。DB2中列加上后数据类型也不能改变,唯一能改变的是增加varchar类型的长度。 7、说明:添加主键: Alter table tabname add primary key(col) 说明:删除主键: Alter table tabname drop primary key(col) 8、说明:创建索引:create [unique] index idxname on tabname(col….) 删除索引:drop index idxname 注:索引是不可更改的,想更改必须删除重新建。 9、说明:创建视图:create view viewname as select statement 删除视图:drop view viewname 10、说明:几个简单的基本的sql语句 选择:select * from table1 where 范围 插入:insert into table1(field1,field2) values(value1,value2) 删除:delete from table1 where 范围 更新:update table1 set field1=value1 where 范围

C builder教程大全

BorlandC++Builder5.0是Interpries(Borland)公司推出的基于C++语言的快速应用程序开发(RapidApplicationDevelopment,RAD)工具,它是最先进的开发应用程序的组件思想和面向对象的高效语言C++融合的产物。C++Builder充分利用了已经发展成熟的Delphi的可视化组件库(VisualComponentLibrary,VCL),吸收了BorlandC++5.0这个优秀编译器的诸多优点。C++Builder结合了先进的基于组件的程序设计技术,成熟的可视化组件库和优秀编译器,调试器。发展到5.0版本,C++Builder已经成为一个非常成熟的可视化应用程序开发工具,功能强大而且效率高。 C++Builder的特色: 1.C++Builder是高性能的C++开发工具 C++Builder是基于C++的,它具有高速的编译,连接和执行速度。同时,C++Builder具有双编译器引擎,不仅可以编译C/C++程序,还能编译ObjectPascal语言程序。 2.C++Builder是优秀的可视化应用程序开发工具 C++Builder是一完善的可视化应用程序开发工具,使程序员从繁重的代码编写中解放出来,使他们能将注意力重点放在程序的设计上,而不是简单的重复的劳动中。同时,它提供的完全可视的程序界面开发工具,从而使程序员对开发工具的学习周期大大缩短。 3.C++Builder具有强大的数据库应用程序开发功能 C++Builder提供了强大的数据库处理功能,它使的程序员不用写一行代码就能开发出功能强大的数据库应用程序,这些主要依赖于C++Builder众多的数据库感知控件和底层的BDE数据库引擎。C++Builder除了支持Microsoft的ADO(ActiveDataObject)数据库连接技术,还提供了一种自己开发的成熟的数据库连接技术——BDE(BorlandDatabaseEngine)数据库引擎。

常用excel函数公式大全

常用的excel函数公式大全 一、数字处理 1、取绝对值 =ABS(数字) 2、取整 =INT(数字) 3、四舍五入 =ROUND(数字,小数位数) 二、判断公式 1、把公式产生的错误值显示为空 公式:C2 =IFERROR(A2/B2,"") 说明:如果是错误值则显示为空,否则正常显示。

2、IF多条件判断返回值 公式:C2 =IF(AND(A2<500,B2="未到期"),"补款","") 说明:两个条件同时成立用AND,任一个成立用OR函数。 三、统计公式 1、统计两个表格重复的内容 公式:B2 =COUNTIF(Sheet15!A:A,A2) 说明:如果返回值大于0说明在另一个表中存在,0则不存在。

2、统计不重复的总人数 公式:C2 =SUMPRODUCT(1/COUNTIF(A2:A8,A2:A8)) 说明:用COUNTIF统计出每人的出现次数,用1除的方式把出现次数变成分母,然后相加。 四、求和公式

1、隔列求和 公式:H3 =SUMIF($A$2:$G$2,H$2,A3:G3) 或 =SUMPRODUCT((MOD(COLUMN(B3:G3),2)=0)*B3:G3)说明:如果标题行没有规则用第2个公式 2、单条件求和 公式:F2 =SUMIF(A:A,E2,C:C) 说明:SUMIF函数的基本用法

3、单条件模糊求和 公式:详见下图 说明:如果需要进行模糊求和,就需要掌握通配符的使用,其中星号是表示任意多个字符,如"*A*"就表示a前和后有任意多个字符,即包含A。

4、多条件模糊求和 公式:C11 =SUMIFS(C2:C7,A2:A7,A11&"*",B2:B7,B11) 说明:在sumifs中可以使用通配符* 5、多表相同位置求和 公式:b2 =SUM(Sheet1:Sheet19!B2) 说明:在表中间删除或添加表后,公式结果会自动更新。 6、按日期和产品求和

窗体控件的属性

1. 窗体与控件 ● 窗体的重要属性 属性说明 Name窗体对象的名字,用于在代码中进行标示BackColor窗体的背景色 BackgroundImage窗体的背景图像 FormBorderStyle窗体的边框样式,有7个可选的值,默认是Sizable MaximizeBox确定窗体标题栏的右上角是否有最大化ShowInTaskbar确定窗体是否出现在Windows任务栏中StartPosition确定窗体第一次出现的位置 Text窗体标题栏中显示的文本 TopMost 只是窗体是否始终显示在此属性为TRUE的所有窗体之上,默认为False WindowState 确定窗体的初始化状态,包括Normal(普通),Maximized(最大化),Minimized(最小化) IsMiContatiner 设定窗体是否为父窗体 注: 子窗体.Mdiparent = this; 在菜单空间的MdiWindowListItem属性为窗口菜单项 事件 Load窗体加载事件MouseClick鼠标单击事件MouseDoubleClic k 鼠标双击事件MouseMove鼠标移动事件 KeyDown键盘按下事件 KeyUp键盘释放事件

●窗体方法 Close() 关闭窗口配合 Show() 显示窗口 ShowDialog() 模式化显示窗口 Hide() 隐藏窗体 ●标签的主要属性 Image 在标签上显示的图片 Text 在标签上显示的文本 ●文本框的主要属性 MaxLength 指定在文本框中输入的最大字符 Multiline 表示是否可在文本框中输入多行文本 PasswordChar 指定在做为密码框时,文本框中显示的字符,而不是实际输入的文本 ReadOniy 指定是否允许编辑文本框中的文本Text 与文本框关联的文本 ●组合框的主要属性 Items 组合框中的选项 DropDownStyle 定义组合框的风格,指示是否显示列表框部分,是否允许用户编辑文本框部分 Text 与组合框关联的文本 SelectedIndex 当前选定项目的索引号,列表框中的每个项都有一个索引号,从0开始 SelectedItem 获取当前选定的项●按钮的主要属性和事件 Enabe 布尔值,表示控件是否可用。True表示可用,False表示不可用,如果控件不可用,运行后显示为灰色 Text 按钮上显示的文本TextAlign 按钮上文本显示对齐方式

16种常用数据分析方法66337

一、描述统计 描述性统计是指运用制表和分类,图形以及计筠概括性数据来描述数据的集中趋势、离散趋势、偏度、峰度。 1、缺失值填充:常用方法:剔除法、均值法、最小邻居法、比率回归法、决策树法。 2、正态性检验:很多统计方法都要求数值服从或近似服从正态分布,所以之前需要进行正态性检验。常用方法:非参数检验的K-量检验、P-P图、Q-Q图、W检验、动差法。 二、假设检验 1、参数检验 参数检验是在已知总体分布的条件下(一股要求总体服从正态分布)对一些主要的参数(如均值、百分数、方差、相关系数等)进行的检验。 1)U验使用条件:当样本含量n较大时,样本值符合正态分布 2)T检验使用条件:当样本含量n较小时,样本值符合正态分布 A 单样本t检验:推断该样本来自的总体均数μ与已知的某一总体均数μ0 (常为理论值或标准值)有无差别; B 配对样本t检验:当总体均数未知时,且两个样本可以配对,同对中的两者在可能会影响处理效果的各种条件方面扱为相似; C 两独立样本t检验:无法找到在各方面极为相似的两样本作配对比较时使用。 2、非参数检验 非参数检验则不考虑总体分布是否已知,常常也不是针对总体参数,而是针对总体的某些一股性假设(如总体分布的位罝是否相同,总体分布是否正态)进行检验。 适用情况:顺序类型的数据资料,这类数据的分布形态一般是未知的。

A 虽然是连续数据,但总体分布形态未知或者非正态; B 体分布虽然正态,数据也是连续类型,但样本容量极小,如10以下; 主要方法包括:卡方检验、秩和检验、二项检验、游程检验、K-量检验等。 三、信度分析 检査测量的可信度,例如调查问卷的真实性。 分类: 1、外在信度:不同时间测量时量表的一致性程度,常用方法重测信度 2、内在信度;每个量表是否测量到单一的概念,同时组成两表的内在体项一致性如 何,常用方法分半信度。 四、列联表分析 用于分析离散变量或定型变量之间是否存在相关。 对于二维表,可进行卡方检验,对于三维表,可作Mentel-Hanszel分层分析。列联表分析还包括配对计数资料的卡方检验、行列均为顺序变量的相关检验。 五、相关分析 研究现象之间是否存在某种依存关系,对具体有依存关系的现象探讨相关方向及相关程度。 1、单相关:两个因素之间的相关关系叫单相关,即研究时只涉及一个自变量和一个因变量; 2、复相关:三个或三个以上因素的相关关系叫复相关,即研究时涉及两个或两个以上的自变量和因变量相关; 3、偏相关:在某一现象与多种现象相关的场合,当假定其他变量不变时,其中两个变量之间的相关关系称为偏相关。 六、方差分析

cbuilder常用函数汇总

c b u i l d e r常用函数汇总 The Standardization Office was revised on the afternoon o f December 13, 2020

c++ builder 常用函数汇总 对话框类函数 打开对话框: if(OpenDialog1->Execute()) { Memo1->Lines->LoadFromFile(OpenDialog1->FileName); } 保存对话框: if(SaveDialog1->Execute()) { Memo1->Lines->SaveToFile(SaveDialog1->FileName); } 其它常用函数 ShowMessage(s);_str(); ShowMessage(s); } //--------------------------------------------------------------------------- SubString(index,count)//字符串裁减函数 Index为字符串的序号,从1开始,count为要裁减的长度,如:String s=Edit1->Text; ShowMessage(1,2)); IntToHex(n1,n2)//十进制转16进制,n1为要转换的数, n2为转换的16进制的位数,如: int i=255; ShowMessage(IntToHex(i,2)); StrToInt(s)//字符串转数字,如: String s="1234";

int i=4321 + StrToInt(s); ShowMessage(i); IntToStr(n)//数字转字符串,如: int i=4321; String s="1234" + IntToStr(i); ShowMessage(s);

Microsoft Visual FoxPro 9.0控件属性详解

VFP表单及控件属性一览表 引用于:https://www.doczj.com/doc/cb808351.html,/club/showpost.asp?id=133720&t=o 本文引用以上网站的内容,经整理和制作成此Word文档,希望对各位有所帮助! A Activate Event 当表单集、表单或页对象激活时、或显示工具栏对象时发生。 ActiveControl 引用一个对象上的活动控件。 ActiveForm 引用表单集或_SCREEN对象中的活动表单对象。 Addobject 在运行时向容器对象中添加一个对象。 AddProperty 向对象添加新属性。 Alignment 控件上正文水平对齐方式。 AlwaysOnBottom 防止其他窗口被表单窗口覆盖。 AlwaysOnTop 防止其他窗口遮挡表单。 Autocenter 指定Form对象在首次显示时,是否自动在VFP主窗口内居中。 AutoSize 控件是否根据正文自动调整大小。

BackColor 指定对象内文本和图形的背景色。 BackStyle 设置背景风格。 BaseClass 指定VFP基类的类名,被引用对象由此基类派生得到。 BorderStyle 指定对象的边框样式。 Box 在表单对象上绘制矩形。 BufferMode 指定记录是保守式更新还是开放式更新。 C Caption 指定对象标题文本。 Circle 在表单上绘制圆或弧。 Class 返回派生对象的类的类名。 ClassLibrary 指定用户自定义类库的文件名,该类库包含对象的类。 Click Event 当用户在一个对象上按下并释放鼠标按钮时,或用编程方式触发该事件时发生ClipControls 指定在Paint事件中,图形方法程序是否会重画整个对象,并且是否创建将非图形控件排除在外的剪切区域。 Closable 指定能否通过双击窗口菜单图标来关闭表单。 Cls 清除表单中的图形和文本。 Color Source 指定控件颜色的设置方式。 Comment 存储对象的有关信息。 ContinuousScroll 指定表单是平滑地滚动还是只在释放滚动框后才重绘。 ControlBox 指定在运行时刻表单或工具栏的左上角是否显示菜单图标。 ControlCount 指定容器对象中控件的数目。 Controls 用于存取容器对象中控件的数组。 CurrentX 指定下一个绘图方法程序的水平坐标。 CurrentY 指定下一个绘图方法程序的垂直坐标。 D DataSession 指定表单、表单集或工具栏能否在自己的数据工作期中运行,并拥有独立的数据环境。 DataSessionID 返回数据工作期标识,该标识用于识别表单集、表单或工具栏的私有数据工作期Dblclick Event 当用户连续快速地按住并释放左(主)鼠标按钮时发生。 Deactivate Event 当一个容器对象如表单,由于其所含对象没有焦点而不再活动时发生。DefoleLCID 指定在此表单上创建的ActiveX控件和可插入对象的默认本地ID,如果该值为零,SYS(3004)将指定默认的本地ID。 Desktop 指定表单是否包含在VFP主窗口中。 Destroy Event 释放一个对象时发生。 DragDrop Event 当拖放操作完成时发生。 DragOver Event 当拖动到一个控件到目标对象上时发生。 Draw 重新绘制表单对象。 DrawMocle 与颜色属性共同指定形状或线条在屏幕上的显示方式。 DrawStyle 指定用图形方法程序绘制时使用的线条样式。 DrawWidth 指定用图形方法程序输出的线条宽度。

15个常用EXCEL函数,数据分析新人必备

15个常用EXCEL函数,数据分析新人必备 本文实际涵盖了15个Excel常用函数,但是按照分类只分了十类。 很难说哪十个函数就绝对最常用,但这么多年来人们的经验总结,一些函数总是会重复出现的。 这些函数是最基本的,但应用面却非常广,学会这些基本函数可以让工作事半功倍。 SUM 加法是最基本的数学运算之一。函数SUM就是用来承担这个任务的。SUM的参数可以是单个数字、一组数字,因此SUM的加法运算功能十分强大。 统计一个单元格区域: =sum(A1:A12) 统计多个单元格区域: =sum(A1:A12,B1:B12) AVERAGE 虽然Average是一个统计函数,但使用如此频繁,应在十大中占有一席之位。 我们都对平均数感兴趣。平均分是多少?平均工资是多少?平均高度是多少?看电视的平均小时是多少?

Average参数可以是数字,或者单元格区域。 使用一个单元格区域的语法结构: =AVERAGE(A1:A12) 使用多个单元格区域的语法结构: =AVERAGE(A1:A12,B1:B12) COUNT COUNT函数计算含有数字的单元格的个数。 注意COUNT函数不会将数字相加,而只是计算总共有多少个数字。因此含有10个数字的列表,COUNT函数返回的结果是10,不管这些数字的实际总和是多少。 COUNT函数参数可以是单元格、单元格引用,甚或数字本身。 COUNT函数会忽略非数字的值。例如,如果A1:A10是COUNT函数的参数,但是其中只有两个单元格含有数字,那么COUNT函数返回的值是2。 也可以使用单元格区域作为参数,如: =COUNT(A1:A12) 甚至是多个单元格区域,如: =COUNT(A1:A12,B1:B12) INT和ROUND INT函数和ROUND函数都是将一个数字的小数部分删除,两者的区别是如何删除小数部分。

ODBC_API常用函数介绍

ODBC API 常用函数诠释
作者: moonbreak, 出处:blog, 责任编辑: 唐小若,
2008-09-03 10:03
ODBC API 是一套复杂的函数集,可提供一些通用的接口,以便访问各种后台数据库。本 文详细介绍了 ODBC API 的常用十四个函数并列出在 PowerBuilder 中外部函数引用声明。 以下为 ODBC API 的常用十四个函数,先列出在 PowerBuilder 中外部函数引用声明:
nv(ref long phenv) library "odbc32.dll"
v(long henv) library "odbc32.dll"
ources(long henv,int fdirection,ref string szdsn,&
er pcbdsn,ref string szdescription,integer cbdescriptionmax,ref integer pcbdescription)library "odbc32.dll"
onnect(long henv,ref long hdbc)library "odbc32.dll"
ct (long hstmt,ref string szdsn,integer dsnlen,ref string
ng szpwd,integer pwdlen) library "odbc32.dll"
nect (long hdbc) library "odbc32.dll"
mt(long hdbc,ref long hstmt)library "odbc32.dll"
long hstmt,ref string sztablequalifier,integer tablequalifierlen,ref string szowner,integer owerlen,ref string szname,integ
pelen)library "odbc32.dll"
ns(long hstmt,ref string sztablequalifier,integer tablequalifierlen,ref string szowner,integer owerlen,ref string szname,in
pelen)library "odbc32.dll"
ol(long hstmt,integer colnum,integer datatype,ref string name,long maxlen,ref long actlen) library "odbc32.dll"
ong hstmt)library "odbc32.dll"
lenv,long hdbc,long hstmt,ref string sqlstate,ref long nativeerror,ref string errormsg,integer errormsgmax,ref integer e
mt(long hstmt,integer Options)library "odbc32.dll" 1、function integer SQLAllocEnv(ref long phenv) library "odbc32.dll" 、 参数: long phenv 引用传递的 long 类型参数, ref 保存该函数返回的 OBDC 环境的句柄。 存放在 phenv 中的值成为以后 OBDC API 函数调用的唯一标识符。 返回值:integer 成功时,返回 0,失败返回值小于 0。 函数功能:获取 ODBC 环境句柄。 2、function integer SQLAllocStmt(long hdbc,ref long hstmt)library 、 "odbc32.dll"

各个控件的属性

常用控件的属性和事件: 一、窗体form 1、name 2、caption 窗体的标题 3、height、width、left、top 窗体的大小和位置 4、backcolor 背景颜色 5、forecolor 前景色 6、font 文字的字体、字号和字形 7、enabled 对象是否有效 8、visible 对象是否可见 9、picture 背景图片 10、controlbox 是否显示窗体的控制菜单框 11、maxbuttom/minbuttom 窗体的最大/最小化按钮属性 12、borderstyle 决定窗体的边框样式6个属性值 13、icon 用于设置窗体左上角的图标??? 二、一般类控件的使用 1、命令按钮Command style 0 or 1 是否能显示背景色或图片 picture 显示按钮的背景图片 default 和cancel 一个设置默认按钮,一个设置取消按钮 caption 2、标签Label alignment 对齐方式 autosize 自动改变大小 caption backstyle 背景是否透明 borderstyle 决定标签的边框类型 3、文本框Textbox text Multiline 是否能输入或显示多行文本 Scrollbars 设置文本框是否具有滚动条只有在Multiline 为ture 才有效Locked 文本是否允许编辑 Passwordchar 用于设置文本框的替代显示字符。 三、选择类控件 1、框架Frame caption enabled visible forecolor backcolor 2、单选按钮和复选框Optionbuttom Checkbox value style

R数据分析常用包与函数

【收藏】R数据分析常用包与函数 2016-09-26 R语言作为入门槛较低的解释性编程语言,受到从事数据分析,数据挖掘工作人员的喜爱,在行业排名中一直保持较高的名次(经常排名第一),下面列出了可用于数据分析、挖掘的R包和函数的集合。 1、聚类 常用的包:fpc,cluster,pvclust,mclust 基于划分的方法: kmeans, pam, pamk, clara 基于层次的方法: hclust, pvclust, agnes, diana 基于模型的方法: mclust 基于密度的方法: dbscan 基于画图的方法: plotcluster, plot.hclust 基于验证的方法: cluster.stats 2、分类 常用的包: rpart,party,randomForest,rpartOrdinal,tree,marginTree, maptree,survival 决策树: rpart, ctree 随机森林: cforest, randomForest 回归, Logistic回归, Poisson回归: glm, predict, residuals 生存分析: survfit, survdiff, coxph 3、关联规则与频繁项集 常用的包: arules:支持挖掘频繁项集,最大频繁项集,频繁闭项目集和关联规则 DRM:回归和分类数据的重复关联模型 APRIORI算法,广度RST算法:apriori, drm ECLAT算法:采用等价类,RST深度搜索和集合的交集:eclat 4、序列模式 常用的包:arulesSequences SPADE算法:cSPADE 5、时间序列 常用的包:timsac 时间序列构建函数:ts 成分分解: decomp, decompose, stl, tsr 6、统计 常用的包:Base R, nlme 方差分析: aov, anova 假设检验: t.test, prop.test, anova, aov

相关主题
文本预览
相关文档 最新文档