Kasutusjuhend Tühista

Use ASP commands to modify database in Dreamweaver

  1. Dreamweaver User Guide
  2. Introduction
    1. Responsive web design basics
    2. What's new in Dreamweaver
    3. Web development using Dreamweaver - An Overview
    4. Dreamweaver / Common Questions
    5. Keyboard shortcuts
    6. Dreamweaver system requirements
    7. Feature summary
  3. Dreamweaver and Creative Cloud
    1. Synchronize Dreamweaver settings with Creative Cloud
    2. Creative Cloud Libraries in Dreamweaver
    3. Using Photoshop files in Dreamweaver
    4. Work with Adobe Animate and Dreamweaver
    5. Extract web-optimized SVG files from Libraries
  4. Dreamweaver workspaces and views
    1. The Dreamweaver workspace
    2. Optimize Dreamweaver workspace for visual development
    3. Search files based on filename or content | Mac OS
  5. Set up sites
    1. About Dreamweaver sites
    2. Set up a local version of your site
    3. Connect to a publishing server
    4. Set up a testing server
    5. Import and export Dreamweaver site settings
    6. Bring existing websites from a remote server to your local site root
    7. Accessibility features in Dreamweaver
    8. Advanced settings
    9. Set site preferences for transferring files
    10. Specify proxy server settings in Dreamweaver
    11. Synchronize Dreamweaver settings with Creative Cloud
    12. Using Git in Dreamweaver
  6. Manage files
    1. Create and open files
    2. Manage files and folders
    3. Getting and putting files to and from your server
    4. Check in and check out files
    5. Synchronize files
    6. Compare files for differences
    7. Cloak files and folders in your Dreamweaver site
    8. Enable Design Notes for Dreamweaver sites
    9. Preventing potential Gatekeeper exploit
  7. Layout and design
    1. Use visual aids for layout
    2. About using CSS to lay out your page
    3. Design responsive websites using Bootstrap
    4. Creating and using media queries in Dreamweaver
    5. Present content with tables
    6. Colors
    7. Responsive design using fluid grid layouts
    8. Extract in Dreamweaver
  8. CSS
    1. Understand Cascading Style Sheets
    2. Laying out pages using CSS Designer
    3. Using CSS preprocessors in Dreamweaver
    4. How to set CSS Style preferences in Dreamweaver
    5. Move CSS rules in Dreamweaver
    6. Convert inline CSS to a CSS rule in Dreamweaver
    7. Work with div tags
    8. Apply gradients to background
    9. Create and edit CSS3 transition effects in Dreamweaver
    10. Format code
  9. Page content and assets
    1. Set page properties
    2. Set CSS heading properties and CSS link properties
    3. Work with text
    4. Find and replace text, tags, and attributes
    5. DOM panel
    6. Edit in Live View
    7. Encoding documents in Dreamweaver
    8. Select and view elements in the Document window
    9. Set text properties in the Property inspector
    10. Spell check a web page
    11. Using horizontal rules in Dreamweaver
    12. Add and modify font combinations in Dreamweaver
    13. Work with assets
    14. Insert and update dates in Dreamweaver
    15. Create and manage favorite assets in Dreamweaver
    16. Insert and edit images in Dreamweaver
    17. Add media objects
    18. Adding videos in Dreamweaver
    19. Insert HTML5 video
    20. Insert SWF files
    21. Add audio effects
    22. Insert HTML5 audio in Dreamweaver
    23. Work with library items
    24. Using Arabic and Hebrew text in Dreamweaver
  10. Linking and navigation
    1. About linking and navigation
    2. Linking
    3. Image maps
    4. Troubleshoot links
  11. jQuery widgets and effects
    1. Use jQuery UI and mobile widgets in Dreamweaver
    2. Use jQuery effects in Dreamweaver
  12. Coding websites
    1. About coding in Dreamweaver
    2. Coding environment in Dreamweaver
    3. Set coding preferences
    4. Customize code coloring
    5. Write and edit code
    6. Code hinting and code completion
    7. Collapse and expand code
    8. Reuse code with snippets
    9. Lint code
    10. Optimize code
    11. Edit code in Design view
    12. Work with head content for pages
    13. Insert server-side includes in Dreamweaver
    14. Using tag libraries in Dreamweaver
    15. Importing custom tags into Dreamweaver
    16. Use JavaScript behaviors (general instructions)
    17. Apply built-in JavaScript behaviors
    18. About XML and XSLT
    19. Perform server-side XSL transformations in Dreamweaver
    20. Performing client-side XSL transformations in Dreamweaver
    21. Add character entities for XSLT in Dreamweaver
    22. Format code
  13. Cross-product workflows
    1. Installing and using extensions to Dreamweaver
    2. In-App updates in Dreamweaver
    3. Insert Microsoft Office documents in Dreamweaver (Windows only)
    4. Working with Fireworks and Dreamweaver
    5. Edit content in Dreamweaver sites using Contribute
    6. Dreamweaver-Business Catalyst integration
    7. Create personalized email campaigns
  14. Templates
    1. About Dreamweaver templates
    2. Recognizing templates and template-based documents
    3. Create a Dreamweaver template
    4. Create editable regions in templates
    5. Create repeating regions and tables in Dreamweaver
    6. Use optional regions in templates
    7. Define editable tag attributes in Dreamweaver
    8. How to create nested templates in Dreamweaver
    9. Edit, update, and delete templates
    10. Export and import xml content in Dreamweaver
    11. Apply or remove a template from an existing document
    12. Edit content in Dreamweaver templates
    13. Syntax rules for template tags in Dreamweaver
    14. Set highlighting preferences for template regions
    15. Benefits of using templates in Dreamweaver
  15. Mobile and multiscreen
    1. Create media queries
    2. Changing page orientation for mobile devices
    3. Create web apps for mobile devices using Dreamweaver
  16. Dynamic sites, pages and web forms
    1. Understand web applications
    2. Set up your computer for application development
    3. Troubleshoot database connections
    4. Removing connection scripts in Dreamweaver
    5. Design dynamic pages
    6. Dynamic content sources overview
    7. Define sources of dynamic content
    8. Add dynamic content to pages
    9. Changing dynamic content in Dreamweaver
    10. Display database records
    11. Provide and troubleshoot live data in Dreamweaver
    12. Add custom server behaviors in Dreamweaver
    13. Building forms using Dreamweaver
    14. Use forms to collect information from users
    15. Create and enable ColdFusion forms in Dreamweaver
    16. Create web forms
    17. Enhanced HTML5 support for form elements
    18. Develop a form using Dreamweaver
  17. Building applications visually
    1. Build master and detail pages in Dreamweaver
    2. Build search and results pages
    3. Build a record insert page
    4. Build an update record page in Dreamweaver
    5. Building record delete pages in Dreamweaver
    6. Use ASP commands to modify database in Dreamweaver
    7. Build a registration page
    8. Build a login page
    9. Build a page that only authorized users can access
    10. Securing folders in Coldfusion using Dreamweaver
    11. Using ColdFusion components in Dreamweaver
  18. Test, preview, and publish websites
    1. Preview pages
    2. Preview Dreamweaver web pages on multiple devices
    3. Test your Dreamweaver site
  19. Troubleshooting
    1. Fixed issues
    2. Known issues

 

 

Learn how to use ASP commands in Dreamweaver to modify a database and add and run a stored procedure.

Märkus.

The user interface has been simplified in Dreamweaver and later. As a result, you may not find some of the options described in this article in Dreamweaver and later. For more information, see this article.

About ASP command objects

An ASP command object is a server object that performs some operation on a database. The object can contain any valid SQL statement, including one that returns a recordset, or one that inserts, updates, or deletes records in a database. A command object can alter the structure of a database if the SQL statement adds or deletes a column in a table. You can also use a command object to run a stored procedure in a database.

A command object can be reusable, in the sense that the application server can reuse a single compiled version of the object to execute the command a number of times. You make a command reusable by setting the Prepared property of the Command object to true, as in the following VBScript statement:

mycommand.Prepared = true

If you know the command will be executed more than a few times, having a single compiled version of the object can make database operations more efficient.

Märkus.

Not all database providers support prepared commands. If your database does not support it, it might return an error when you set this property to true. It might even ignore the request to prepare the command and set the Prepared property to false.

A command object is created by scripts on an ASP page, but Dreamweaver lets you create command objects without writing a line of ASP code.

Use ASP commands to modify a database

You can use Dreamweaver to create ASP command objects that insert, update, or delete records in a database. You supply the command object with the SQL statement or stored procedure that performs the operation on the database.

  1. In Dreamweaver, open the ASP page that will run the command.
  2. Open the Server Behaviors panel (Window > Server Behaviors), click the Plus (+) button, and select Command.
  3. Enter a name for the command, select a connection to the database that contains the records you want to edit, and select the editing operation that you want the command to perform—Insert, Update, or Delete.

    Dreamweaver starts the SQL statement, based on the type of operation you select. For example, if you select Insert, the dialog box looks like the following example:

    Enter the ASP command
    Enter the ASP command

  4. Complete the SQL statement.

    For information on writing SQL statements that modify databases, consult a Transact‑SQL manual.

  5. Use the Variables area to define any SQL variables. Provide the name and run-time value. Specifying the type and size of each variable prevents injection attacks.

    The following example shows an Insert statement that contains three SQL variables. The values of these variables are provided by URL parameters passed to the page, as defined in the Run‑Time Value column of the Variables area.

    An Insert statement that contains three SQL variables
    An Insert statement that contains three SQL variables

    To get the Size value, use the Databases panel in Dreamweaver. Find your database in the Databases panel and expand it. Next, find the table you’re working with and expand it. The table lists the sizes for your fields. For example, it might say ADDRESS (WChar 50). In this example, 50 is the size. You can also find the size in your database application.

    Märkus.

    Numeric, Boolean and date/time data types always use -1 as the size.

    To determine the Type value, see the following table:

    Type in database

    Type in Dreamweaver

    Size

    Numeric (MS Access, MS SQL Server, MySQL)

    Double

    -1

    Boolean, Yes/No (MS Access, MS SQL Server, MySQL)

    Double

    -1

    Date/Time (MS Access, MS SQL Server, MySQL)

    DBTimeStamp

    -1

    All other types of text fields, including the MySQL text data types char, varchar and longtext

    LongVarChar

    check database table

    Text (MS Access) or nvarchar, nchar (MS SQL Server)

    VarWChar

    check database table

    Memo (MS Access), ntext (MS SQL Server), or fields that support large amounts of text

    LongVarWChar

    1073741823

    For more information on the type and size of SQL variables, see www.adobe.com/go/4e6b330a.

  6. Close the dialog box.

    Dreamweaver inserts ASP code in your page that, when run on the server, creates a command that inserts, updates, or deletes records in the database.

    By default, the code sets the Prepared property of the Command object to true, which makes the application server reuse a single compiled version of the object every time the command is run. To change this setting, switch to Code view and change the Prepared property to false.

  7. Create a page with an HTML form so users can enter record data. In the HTML form, include three text fields (txtCity, txtAddress, and txtPhone) and a submit button. The form uses the GET method and submits the text field values to the page that contains your command.

About stored procedures

Although you can use server behaviors to build pages that modify databases, you can also use database manipulation objects such as stored procedures or ASP command objects to build the pages.

A stored procedure is a reusable database item that performs some operation on the database. A stored procedure contains SQL code that can, among other things, insert, update, or delete records. Stored procedures can also alter the structure of the database itself. For example, you can use a stored procedure to add a table column or even delete a table.

A stored procedure can also call another stored procedure, as well as accept input parameters and return multiple values to the calling procedure in the form of output parameters.

A stored procedure is reusable in the sense that you can reuse a single compiled version of the procedure to execute a database operation a number of times. If you know a database task will be executed more than a few times—or the same task will be executed by different applications—using a stored procedure to execute that task can make database operations more efficient.

Märkus.

MySQL and Microsoft Access databases do not support stored procedures.

Add a stored procedure (ColdFusion) (CS6)

You can use a stored procedure to modify a database. A stored procedure is a reusable database item that performs some operation on the database.

Before you use a stored procedure to modify a database, make sure the stored procedure contains SQL that modifies the database in some way. To create and store one in your database, consult your database documentation and a good Transact-SQL manual.

  1. In Dreamweaver, open the page that will run the stored procedure.
  2. In the Bindings panel (Window > Bindings), click the Plus (+) button, and then select Stored Procedure.
  3. In the Data Source pop‑up menu, select a connection to the database containing the stored procedure.
  4. Enter the ColdFusion Data Source user name and password.
  5. Select a stored procedure from the Procedures pop‑up menu.

    Dreamweaver automatically fills in any parameters.

  6. Select a parameter, and click Edit if you have to make changes.

    The Edit Stored Procedure Variable dialog box appears. The name of the variable you are editing appears in the Name box.

    Märkus.

    You must enter test values for any stored procedure input parameters.

  7. Make changes as necessary:
    • Select a Direction from the pop‑up menu. A stored procedure might have input values, output values, or both input and output values.

    • Select a SQL type from the pop‑up menu. Enter a return variable, a run-time value, and a test value.

  8. If the stored procedure takes a parameter, click the Plus (+) button to add a page parameter.
    Märkus.

    You must enter corresponding page parameters for each stored procedure parameter return value. Do not add page parameters unless there is a corresponding return value.

    Click the Plus (+) button again to add another page parameter, if necessary.

  9. Select a page parameter, and click the Minus (-) button to delete the parameter if necessary or click Edit to make changes to the parameter.
  10. Select the Returns Recordset Named option, and then enter a name for the recordset; if the stored procedure returns a recordset, click the Test button to see the recordset that the stored procedure returns.

    Dreamweaver runs the stored procedure and displays the recordset, if any.

    Märkus.

    If the stored procedure returns a recordset and takes parameters, you must enter a value in the Default Value column in the Variables box to test the stored procedure.

    Märkus.

    You can use different test values to generate different recordsets. To change test values, click the Edit button for Parameter, and change the test value, or click the Edit button for Page Parameter and change the default value.

  11. Select the Returns Status Code Named option, enter a name for the status code, if the stored procedure returns a status code return value. Click OK.

    After you close the box, Dreamweaver inserts ColdFusion code in your page that calls a stored procedure in the database, when the code runs on the server. The stored procedure in turn performs a database operation, such as inserting a record.

    If the stored procedure takes parameters, you can create a page that gathers the parameter values and submits them to the page with the stored procedure. For example, you may create a page that uses URL parameters or an HTML form to gather parameter values from users.

Run a stored procedure (ASP) (CS6)

With ASP pages, you must add a command object to a page to run a stored procedure. For more information on command objects, see About ASP command objects.

  1. In Dreamweaver, open the page that will run the stored procedure.
  2. In the Bindings panel (Window > Bindings), click the Plus (+) button, and then select Command (Stored Procedure).

    The Command dialog box appears.

  3. Enter a name for the command, select a connection to the database containing the stored procedure, and then select Stored Procedure from the Type pop‑up menu.
  4. Select your stored procedure by expanding the Stored Procedures branch in the Database Items box, selecting the stored procedure from the list, and clicking the Procedure button.
  5. Enter any required parameters in the Variables table.

    You don’t need to enter any parameters for any RETURN_VALUE variable.

  6. Click OK.

    After you close the dialog box, ASP code is inserted in your page. When the code runs on the server, the code creates a command object that runs a stored procedure in the database. The stored procedure in turn performs a database operation, such as inserting a record.

    By default, the code sets the Prepared property of the Command object to true, which makes the application server reuse a single compiled version of the object every time the stored procedure is run. If you know the command will be executed more than a few times, having a single compiled version of the object can improve the efficiency of database operations. However, if the command will only be executed one or two times, using one might actually slow down your web application because the system has to pause to compile the command. To change the setting, switch to Code view and change the Prepared property to false.

    Märkus.

    Not all database providers support prepared commands. If your database does not support it, you might get an error message when you run the page. Switch to Code view and change the Prepared property to false.

    If the stored procedure takes parameters, you might create a page that gathers the parameter values and submits them to the page with the stored procedure. For example, you may create a page that uses URL parameters or an HTML form to gather parameter values from users.

 Adobe

Saage abi kiiremini ja hõlpsamalt

Uus kasutaja?