Re: newbie: how to implement vb recordsets in stored procedures

From: William Morris (news.remove.this.and.the.dots_at_seamlyne.com)
Date: 02/16/04


Date: Mon, 16 Feb 2004 09:49:50 -0600

For the example you've posted, a simple update statement will give you what
you want.

UPDATE table1
SET field3 = 1
WHERE field1 > 0
AND field2 > 0

If you're going to work in SQL you'll want to stop thinking in procedural
terms. Just about anything you'd want to do can be accomplished with SQL
statements of varying complexity without resorting to vb-style coding. Keep
your eyes and your mind open; it's a big mental shift, but once you do
you'll like the efficiency you get.

-- 
William Morris
Product Development, Seritas LLC
Kansas City, Missouri
<Joost> wrote in message news:%23Upy9AK9DHA.1936@TK2MSFTNGP12.phx.gbl...
> Hi group,
>
> Can sombody give me some pointers in how to convert visual basic code with
> recordsets to a stored procedures.
>
> For example: how should i implement the following.
>
>    Set rs = CurrentDb.OpenRecordset("SELECT * FROM Table1 WHERE KeyField="
&
> mId)
>    rs.Edit
>
>    If rs!Field1 > 0 And rs!Field2 > 0 Then
>       rs!Field3 = 1
>    End If
>
>    rs.Update
>    rs.Close
>
> Please understand that this is only a short example. I have lots of lines
of
> visual basic code thes way that specify the business rules.
>
> Any help is highly appreciated.
>
> Joost.
>
>


Relevant Pages

  • Re: Writing updates from a wide DataTable
    ... I would personally not use stored procedures in this case. ... You can build your own update statement. ... >following the recommendations to use stored procedures to apply updates to ... >the database, ...
    (microsoft.public.dotnet.framework.adonet)
  • RE: sp_droporphans
    ... The sp_createorphan and sp_droporphans stored procedures are used for ODBC ... ntext, text, and image processing. ... Check what users are processing at the same time agaisnt your table. ...
    (microsoft.public.sqlserver.programming)