Re: Simple Best Practice Question
From: Marek (Marek_at_discussions.microsoft.com)
Date: 10/19/04
- Next message: Raymond D'Anjou \(raydan\): "Re: Toolbar in Design View of a table?"
- Previous message: Patrick: "Multiple instances name ?"
- In reply to: Arnie Rowland: "Re: Simple Best Practice Question"
- Next in thread: Philippe [MS]: "Re: Simple Best Practice Question"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 19 Oct 2004 12:25:04 -0700
Thanks for that. Clears things up a little. Think I will buy that book you
recommend. The only thing I am unsure of is how I update only the fields
that have changed value? Or, do I just update the entire record with all the
values on the form irrespective of whether they have been changed.
"Arnie Rowland" wrote:
> No, the code doesn't determine which column to update -YOU have to make that
> determination.
>
> When you call the sproc, pass in the variables (parameters) from the screen
> forms (textbox values, etc.) In the stored procedure assign a parameter to
> receive each variable passed, and then SET the appropriate column =
> parameter .
>
> Working with what Uri provided you,
>
> CREATE PROC MyProc
> ( --This is the input paramter list
> @PKValue datatype
> , @Param1 datatype
> , @Param2 datatype
> , @Param3 datatype
> [, etc.]
> )
> AS
> UPDATE MyTable
> SET --This is where you assign input parameter values to columns
> Column1 = Param1
> , Column2 = Param2
> , Column3 = Param3
> [, etc]
> WHERE --Use the Primary Key Value to update the correct row in the table
> PKColumn = @PKValue
>
>
>
>
> I recommend the following book:
>
> Beginning SQL Programming (Programmer to Programmer), John Kauffman, Brian
> Matsik, Kevin Spencer, Ian Herbert, Sakhr Youness, Julian Skinner, ISBN:
> 1861001800
> The book gives step-by-step instructions, alerts readers to common pitfalls,
> tricks and traps, and uses real-world examples, including two extensive case
> studies, to create a thorough tutorial. It will furnish readers with a firm
> grasp of SQL concepts that you can work with straight away, as well as
> provide solid foundations and challenging ideas with which you can later
> develop more advanced SQL techniques.
>
>
>
>
- Next message: Raymond D'Anjou \(raydan\): "Re: Toolbar in Design View of a table?"
- Previous message: Patrick: "Multiple instances name ?"
- In reply to: Arnie Rowland: "Re: Simple Best Practice Question"
- Next in thread: Philippe [MS]: "Re: Simple Best Practice Question"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|