Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 27th, 2007, 02:55 PM
Friend of Wrox
 
Join Date: May 2005
Posts: 149
Thanks: 0
Thanked 0 Times in 0 Posts
Default why does only my password field get updated??!!!!

Hi,
I use asp.net 2
i have a form that gets the values from my sql db

i use the following code but only my password field gets updated!!!!!

 Dim cnn As New SqlClient.SqlConnection(strConnection)
        cnn.Open()

        Dim cmd As New SqlClient.SqlCommand("K1SP_updateProfile")
        cmd.CommandType = CommandType.StoredProcedure
        cmd.Connection = cnn

        Dim strPWEncoded As String = FormsAuthentication.HashPasswordForStoringInConfig File(PWD.Text, "SHA1")

        With cmd.Parameters

            Dim strFname As String = fname.Text

            cmd.Parameters.Add("@Fname", SqlDbType.NVarChar, 50)
            cmd.Parameters("@Fname").Value = strFname

            cmd.Parameters.Add("@Lname", SqlDbType.NVarChar, 50)
            cmd.Parameters("@Lname").Value = Lname.Text


            cmd.Parameters.Add("@Email", SqlDbType.VarChar, 80)
            cmd.Parameters("@Email").Value = Email.Text

            cmd.Parameters.Add("@City", SqlDbType.NVarChar, 50)
            cmd.Parameters("@City").Value = City.Text


            cmd.Parameters.Add("@State", SqlDbType.NVarChar, 50)
            cmd.Parameters("@State").Value = ddlStates.SelectedValue


            cmd.Parameters.Add("@Pwd", SqlDbType.NVarChar, 100)
            cmd.Parameters("@Pwd").Value = strPWEncoded

            cmd.Parameters.Add("@UserID", SqlDbType.Int)
            cmd.Parameters("@UserID").Value = Session("k1UserID")

        End With

        cmd.ExecuteNonQuery()

 
Old May 28th, 2007, 08:11 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there.. maybe a problem with the SP???

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
 
Old May 28th, 2007, 08:44 AM
Friend of Wrox
 
Join Date: May 2005
Posts: 149
Thanks: 0
Thanked 0 Times in 0 Posts
Default

No i don't think so
here is the sp:
if exists (select * from dbo.sysobjects where id = object_id(N'K1SP_UpdateProfile') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [K1SP_UpdateProfile]
GO

CREATE PROCEDURE K1SP_UpdateProfile
  @Fname nvarchar(50) = NULL,
  @Lname nvarchar(50) = NULL,
  @email nvarchar(80) = NULL,
  @pwd nvarchar(100) = NULL,
  @State varchar(5) = NULL,
  @city nvarchar(50) = NULL,
  @UserID Int
AS
UPDATE k1_Users SET firstname=@Fname,lastname=@Lname,email=@email,city =@city,state=@state,password=@pwd WHERE UserID =@UserID
GO

 
Old May 28th, 2007, 08:58 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

mmm.. the SP looks ok.. maybe you are sending blank fields in the rest of the data????

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
 
Old May 28th, 2007, 10:25 AM
Friend of Wrox
 
Join Date: May 2005
Posts: 149
Thanks: 0
Thanked 0 Times in 0 Posts
Default

No everything is ok
here is the code:
  Sub Display_UserInfo()
        Dim dr As SqlDataReader
        Dim cmd As SqlCommand
        Dim strUserID As String = ""

        Dim strSQL As String
        strSQL = "SELECT userid,status,firstname,lastname,email,state,city FROM k1_Users where userid=@UserID and Status=1"

        Dim cnn As New SqlClient.SqlConnection(strConnection)

        cnn = New SqlConnection(strConnection)
        cmd = New SqlCommand(strSQL, cnn)
        cmd.Parameters.Add(New SqlParameter("@Userid", Session("k1UserID")))
        'With cmd.Parameters
        ' cmd.Parameters.Add("@UserID", SqlDbType.Int)
        ' cmd.Parameters("@UserID").Value = Session("k1UserID")
        'End With

        cnn.Open()

        dr = cmd.ExecuteReader()

        If dr.HasRows = False Then
            Response.Redirect("index.aspx?err=1")
        End If

        dr.Read()
        fname.Text = dr("firstName")
        Lname.Text = dr("lastName").ToString
        Email.Text = dr("email").ToString
        City.Text = dr("city").ToString
        'ddlStates.Items.FindByValue(dr("state")).Selected = True

        ddlStates.SelectedValue = dr("state").ToString

        dr.Close()

 
Old May 28th, 2007, 12:14 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

I'm clueless them... are you sure that you are passing data to the SP?? and not blank fields?? can you trace it????

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to check the password field for case-sensitive zubash73 ASP.NET 2.0 Basics 4 November 27th, 2016 02:47 AM
When/How does hidden ViewState field get updated? Rex777 BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 5 September 23rd, 2008 03:56 PM
Password Field in Sql Server 2005 Plz help zrtv SQL Server 2005 2 January 7th, 2008 06:26 PM
Data not getting updated Renu ASP.NET 1.0 and 1.1 Basics 10 August 21st, 2004 05:39 PM
Encrypted Password field knight Classic ASP Databases 7 June 28th, 2004 12:35 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.