update gridview with stored procedure??

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hemantc87
    New Member
    • Mar 2010
    • 13

    #1

    update gridview with stored procedure??

    i am using this stored procedure to update my gridview
    Code:
    CREATE PROCEDURE [dbo].[updatestdnt]
    @Name varchar(20),
    @Course varchar(20),
    @Age numeric,
    @Sex varchar(20),
    @DateofBirth datetime,
    @Address  varchar(20),
    @Contactno numeric,
    @Email varchar(20),
    @studentid varchar(10),
    @password varchar(10)
    AS
    UPDATE Student SET
    Name=@Name ,
    Course=@Course,
    Age=@Age,
    Sex=@Sex,
    DateofBirth=@DateofBirth,
    Address=@Address,
    Contactno=@Contactno,
    Email=@Email,
    studentid=@studentid,
    password=@password
    where Contactno=@Contactno
    but the Name after
    UPDATE Student SET statement
    appers in blue and wen i try to run this procedure in my website it says the name parameter has not been supplied?? is the procedure wrong as Name appears in blue??
    and in where clause i used Contactno because its the primary key..is this where method correct??
  • Delerna
    Recognized Expert Top Contributor
    • Jan 2008
    • 1134

    #2
    try putting name in square brackets
    [code=sql]
    ........
    UPDATE Student SET
    [Name]=@Name ,
    ...........
    [/code]

    name is a function that
    Returns the name of a level, dimension, member, or hierarchy.
    that's why it is blue

    To use a function name as a field name you must explicitly identify it as a field name
    with [] otherwise it will be treated as a fuction and generate an error

    Comment

    Working...