61阅读

using-Using the Execute SQL Statement

发布时间:2018-04-17 所属栏目:宝宝c反应蛋白大于100

一 : Using the Execute SQL Statement

Adobe Enterprise Technical Enablement

Using the Execute SQL Statement Operation

In this topic, you will learn about the Execute SQL Statement operation and how it is used to interact with databases.

Objectives

After completing this unit, you should be able to

?Use the Execute SQL Statement operation to insert data into a database

?Use the SQL Statement Info Editor dialog box to create and test SQL statementsConcepts

In this topic, you will learn about the following concepts

?Using the Execute SQL Statement operation

executesql Using the Execute SQL Statement

Using the Execute SQL Statement operation

?The Execute SQL Statement operation is used to execute a SQL statement on a database from a process

■Returns the number of rows that were affected

■Typically used for SQL statements that do not return a result set, such as Insert,

Update, and Delete statements

■Located in Foundation > JDBC - 1.0

Figure 1:

executesql Using the Execute SQL Statement

Locating the Execute SQL Statement operation of the JDBC service

executesql Using the Execute SQL Statement

Setting Execute SQL Statement operation properties

?When an Execute SQL Statement operation is added to a process, the following properties can be defined in the Properties view

■Datasource name

–literal value or variable

–corresponds to the JNDI name configured for the data source

–formatted with a java:/ prefix

?java:/adobeTraining

■SQL Statement

–the SQL statement to execute on the database server

–SQL Statement Info Editor is used to specify the value

■Number of rows affected - Returned by the database - the number of rows that the SQL statement affected

Figure 2:

executesql Using the Execute SQL Statement

Execute SQL Statement properties

executesql Using the Execute SQL Statement

Using the SQL Statement Info Editor

?Use the SQL Statement Info Editor dialog box to create and test SQL statements

?Invoked by clicking the ellipsis next to the SQL Statement input property of the Execute SQL Statement operation

?The SQL statements can include XPath expressions as well as parameter values

?Type the SQL statement in the SQL Statement box

?To use a parameter in a SQL statement, use a question mark (?) as a placeholder for the parameter

?Click the Test button to test the SQL statement and to see the results

Figure 3: SQL Statement Info Editor

Including XPath expressions

?XPath expressions can be used to include references to process data in SQL statements?In SQL statements, XPath expressions must appear inside braces and between dollar signs, as in {$ XPath expression $}

?To create an XPath expression using XPath Builder, click the XPath button below the SQL Statement box

SELECT fname FROM table1 WHERE fname LIKE '{$ /process_data/

executesql Using the Execute SQL Statement

@first_name$}%'

executesql Using the Execute SQL Statement

Including parameters

?To use parameters in SQL statements, place a question mark (?) in the SQL statement to represent the parameters

SELECT fname FROM table1 WHERE fname LIKE ?

?

?

?

?A parameter must be defined for each question mark placed in the statementUse Parameterized Query must also be selectedTo define a parameter, add a row to the parameter table by clicking the + buttonThe order in which the parameters are defined in the table is the order in which they appear in the statement

■Index - An index that identifies the parameter

■Type - The type of data that the parameter holds

■Value - The value to use for the parameter

■Test Value - A literal value to use for the parameter when testing the statement

executesql Using the Execute SQL Statement

Task 1:?Inserting data into a database

In this task, you will perform the following

?Open a process

?Configure an Execute SQL Statement operation

?Test the process

Setup

1.Create the adobetraining database.

2.Import the Execute_SQL_Statement.lca file.

Steps

Open a process

1.Login to the Workbench.

2.Open the Execute_SQL_Statement application.

3.Expand the Processes folder, right-click the ExecuteSQLStatement process and select Check Out.

4.Double-click the ExecuteSQLStatement process to open it.

5.From the Variables view, create the following process variables.

Table 1: Process variables to create

executesql Using the Execute SQL Statement

扩展:statement.execute / pdostatement execute / statement的execute

Configure an Execute SQL Statement operation

6.From the process diagram palette, drag the Activity Picker activity onto your process diagram.

7.In the Define Activity dialog box, expand the Foundation category.

8.From the JDBC service, select the Execute SQL Statement operation and click OK.

9.Select the Execute SQL Statement operation and set the following properties. The XPath Builder can be used to help construct the SQL Statement.

?Name: Insert Row in DB

?Datasource name (literal value): java:/AdobeTraining

10.Click the ellipsis button next to the SQL Statement property to open the SQL Statement Info

Editor.

executesql Using the Execute SQL Statement

11.Set the SQL Statement property.

?INSERT into employee VALUES (?,?,?)

12. Select the Use Parameterized Query option.

13.Use the editor to create the following parameters.

Table 2: Parameter values

executesql Using the Execute SQL Statement

executesql Using the Execute SQL Statement

14.Click the Test button and confirm that the SQL statement executed successfully.

15.Click OK to save the changes to the SQL statement and close the SQL Statement Info Editor.

16.Save the process and Deploy the application.

Test the process

17.Right click in an empty area of the process diagram and select Invoke Process...

executesql Using the Execute SQL Statement

18.A dialog will appear prompting for values for empID, firstName and lastName. Enter the

following values and click OK.

19.A dialog will appear stating that the invocation completed successfully (in the title) and the

process has no output variables. Click OK.20.To verify that the record was inserted into the database, open Windows Explorer and navigate

to C:AdobeTrainingDoc_ServicesFoundationExecute_SQL_Statement.

21.Double-click on the showEmployees.bat file.22.

executesql Using the Execute SQL Statement

executesql Using the Execute SQL Statement

Verify that 2 employees have been inserted into the database.

executesql Using the Execute SQL Statement

Summary

?The Execute SQL Statement operation executes a SQL statement and outputs the number of affected rows

?The Execute SQL Statement operation is typically used for SQL statements that do not return a result set, such as Insert, Update, and Delete statements

executesql Using the Execute SQL Statement

Review

1.What happens when a Query Single Row operation has a SQL Statement that returns multiple

rows?

2.When creating a SQL statement using the SQL Statement Info Editor, what is the purpose of the

Use Parameterized Query option?

Adobe Systems Incorporated345 Park AvenueSan Jose, CA 95110-2704USAwww.adobe.comAdobe, Acrobat, Adobe AIR, AIR, Distiller, Flash, Flash Builder, Flash Catalyst, Flex, Adobe Digital Enterprise Platform, MXML, PostScript, Reader, SiteCatalyst, SearchCenter, Discover, Recommendations, Insight, Test&Target, ReportBuilder, Survey, Search&Promote, and Social Media are either registered trademarks or trademarks of Adobe Systems Incorporated in the United States and/or other countries.? 2011 Adobe Systems Incorporated. All rights reserved.

扩展:statement.execute / pdostatement execute / statement的execute

二 : using的用法

C#中using的用法,大致可以归为三种:

1、using指令,引用命名空间的名字,这样可以在程序中直接用命令空间中的类型,而不必指定类型的详细命名空间,类似于Java的import,这个功能也是最常用的,几乎每个cs的程序都会用到。

2、using别名。using + 别名 = 包括详细命名空间信息的具体的类型。
这种做法有个好处就是当同一个cs引用了两个不同的命名空间,但两个命名空间都包括了一个相同名字的类型的时候。当需要用到这个类型的时候,就每个地方都要用详细命名空间的办法来区分这些相同名字的类型。而用别名的方法会更简洁,用到哪个类就给哪个类做别名声明就可以了。注意:并不是说两个名字重复,给其中一个用了别名,另外一个就不需要用别名了,如果两个都要使用,则两个都需要用using来定义别名的。

using System;
using aClass = NameSpace1.MyClass;
using bClass = NameSpace2.MyClass;
using的用法
using的用法namespaceNameSpace1
using的用法{
using的用法public class MyClass
using的用法 {
using的用法public override string ToString()
using的用法 {
using的用法return "You arein NameSpace1.MyClass";
using的用法 }
using的用法 }
using的用法}
using的用法
using的用法namespaceNameSpace2
using的用法{
using的用法class MyClass
using的用法 {
using的用法public override string ToString()
using的用法 {
using的用法return "You arein NameSpace2.MyClass";
using的用法 }
using的用法 }
using的用法}
using的用法
using的用法namespacetestUsing
using的用法{
using的用法using NameSpace1;
using的用法using NameSpace2;
using的用法 /// <summary>
using的用法/// Class1 的摘要说明。
using的用法 ///</summary>
using的用法class Class1
using的用法 {
using的用法 /// <summary>
using的用法/// 应用程序的主入口点。
using的用法 ///</summary>
using的用法[STAThread]
using的用法static void Main(string[] args)
using的用法 {
using的用法//
using的用法// TODO: 在此处添加代码以启动应用程序
using的用法//
using的用法
using的用法aClass my1 =new aClass();
using的用法Console.WriteLine(my1);
using的用法bClass my2 =new bClass();
using的用法Console.WriteLine(my2);
using的用法Console.WriteLine("Pressany keyusing的用法");
using的用法Console.Read();
using的用法 }
using的用法 }
using的用法}

3、using语句,定义一个范围,在范围结束时处理对象。
场景:
当在某个代码段中使用了类的实例,而希望无论因为什么原因,只要离开了这个代码段就自动调用这个类实例的Dispose。
要达到这样的目的,用try...catch来捕捉异常也是可以的,但用using也很方便。
例如:
using (Class1 cls1 = new Class1(), cls2 = new Class1())
using的用法{
using的用法// the code using cls1, cls2
using的用法
using的用法
using的用法} //call the Dispose on cls1 andcls2
这里触发cls1和cls2的Dispose条件是到达using语句末尾或者中途引发了异常并且控制离开了语句块。

三 : 关于c# using system

关于c# using system

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

关于c# using system的参考答案

using System;//引入核心命名空间,是一切类的基础

using System.Collections.Generic;//引入集合类命名空间,能够使用泛型类等集合类

using System.ComponentModel;//引入ComponentModel命名空间

using System.Data;//引入数据操作命名空间,能够使用如DataSet数据集类

using System.Drawing;//引入绘图命名空间,能够使用如Color的类

using System.Text;//引入文本操作命名空间,能够使用如StringBuilder、字符操作等类

using System.Windows.Forms; //引入窗体命名空间,支持窗体相关的类

引用命名空间为的就是能够直接使用隶属于对应命名空间内的类.

本文标题:using-Using the Execute SQL Statement
本文地址: http://www.61k.com/1119997.html

61阅读| 精彩专题| 最新文章| 热门文章| 苏ICP备13036349号-1