beautypg.com

Writing sql for asp.net, About url and form parameters – Adobe Dreamweaver CS3 User Manual

Page 551

background image

DREAMWEAVER CS3

User Guide

544

Before you define a recordset for use with Dreamweaver, you must create a connection to a database and—if no data
exists yet—enter data into the database. If you have not yet defined a database connection for your site, refer to the
database connection chapter for the server technology you are developing for, and follow the instructions on creating
a database connection.

See also

“Define a recordset without writing SQL” on page 547

Writing SQL for ASP.NET

When writing SQL statements in the Advanced DataSet dialog box, there are conditions specific to ASP.NET that
you must be aware of. These conditions are described in the next sections.

Parameters

The syntax you use to reference parameters varies depending on the database connection in use (for example, OLE
DB or Microsoft SQL Server).

OLE DB

When connecting to a database using OLE DB, parameters must be referenced using a question mark (?). For
example:

SELECT * FROM Employees WHERE HireDate > ?

Microsoft SQL Server

When connecting to Microsoft SQL Server using the Managed Data Provider for SQL Server supplied with the .NET
Framework, all parameters must be named. For example:

SELECT * FROM Employees WHERE HireDate > @hireDate

Insert code within SQL statements

When inserting code within SQL statements written for ASP.NET, you must enclose all strings in quotes (" "), and
enclose the code in parentheses ( ).

SELECT * FROM Employees WHERE HireDate > "+ (Request.queryString("hireDate"))

See also

“Database connections for ASP.NET developers” on page 518

About URL and form parameters

URL parameters store retrieved information input by users. To define a URL parameter you create a form or
hypertext link that uses the

GET

method to submit data. The information is appended to the URL of the requested

page and communicated to the server. When using URL variables, the query string contains one or more name-value
pairs that are associated with the form fields. These name-value pairs are appended to the URL.

Form parameters store retrieved information that is included in the HTTP request for a web page. If you create a
form that uses the

POST

method, the data submitted by the form is passed to the server. Before you begin, make sure

you pass a form parameter to the server.

September 4, 2007