<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../../style.css">
<title>
Gambas Documentation - DB.Edit
 (gb.db)</title>
</head>
<table class="none" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr><td align="left">
<font size="-1">
<a href="../../../../help+en"><img class="flag" alt="Home" border="0" src="../../../../img/lang/en.png" align="center"></a>&nbsp;
<a href="../db+en">Up</a>&nbsp;
<a href="delete+en">Previous</a>&nbsp;
<a href="exec+en">Next</a>&nbsp;
</td></tr></table>
<div class="notab">
<h1>
DB.Edit
 (gb.db)</h1>
<div class="black"><font size="-2"><b>Syntax</b></font></div>
<pre class="syntax"><font color="blue">STATIC</font> <font color="blue">FUNCTION</font> <b>Edit</b> <font color="blue">(</font> <u>Table</u> <font color="blue">AS</font> <font color="#0080FF">String</font> <b>[</b> <font color="blue">,</font> <u>Request</u> <font color="blue">AS</font> <font color="#0080FF">String</font><font color="blue">,</font> <u>Arguments</u> <font color="blue">AS</font> , ... <b>]</b> <font color="blue">)</font> <font color="blue">AS</font> <font color="#0080FF"><a href="../result+en">Result</a></font></pre>
Returns a read/write <a href="../result+en">Result</a> object used for editing records in the specified
table.
<p>
<ul>
<li><u>Table</u> is the table name.
<li><u>Request</u> is a SQL WHERE clause used for filtering the table.
<li><u>Arguments</u> are quoted as needed by the SQL syntax, and substituted inside the <u>Request</u> string
<p>
</ul>

The last feature allows you to write requests that are independant of the underlying database type.
<p>
<div class="gray"><font size="-2"><b>Example</b></font></div>
<pre class="example">DIM hResult AS Result
DIM sCriteria AS String
DIM iParemeter AS Integer

' Same as Select * from tblDEFAULT where id = [parameter value]
sCriteria = &quot;id = &1&quot;
iParameter = 1012

$hConn.Begin

hResult = $hConn.Edit(&quot;tblDEFAULT&quot;, sCriteria, iParameter)
' Set field value
hResult!Name = &quot;Mr Smith&quot;

' Update the value
$hConn.Update
$hConn.Commit</pre>
<p>
<hr><b>See also</b><br>
<a href="delete+en">Delete</a>&nbsp; <a href="find+en">Find</a>&nbsp; <a href="exec+en">Exec</a>&nbsp; <a href="subst+en">Subst</a>&nbsp;

</div>
</body>
</html>

