Solved

vb.net 4  asp.net 4 web sql parameter

Posted on 2011-03-25
2
254 Views
Last Modified: 2012-05-11
Hello.  I am trying to have my code update a database table.  I want to create a parameter based on the value of label 3 and I am not exactly sure what I am doing wrong.  

Basically I want to use username as a parameter and I want username to always equal label3.text

Any help would be greatly appreciated.
Protected Sub ChangePasswordPushButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim username As String
        username = Label3.Text


        Dim dbcon2 As New SqlConnection("Data Source=db_server;Initial Catalog=StatementWeb;User ID=steve;Password=stephen")
        dbcon2.Open()
        Dim dbcmd2 As New SqlCommand
        dbcmd2.Connection = dbcon2
        dbcmd2.CommandText = "update [userinfo] set [pwchange]='No' WHERE ([UserName] = @username)" 
        Dim Value2 As String = dbcmd2.ExecuteScalar()
        dbcmd2.Dispose()
        dbcon2.Dispose()
    End Sub

Open in new window

0
Comment
Question by:bidgadget
2 Comments
 
LVL 13

Accepted Solution

by:
agarwalrahul earned 500 total points
ID: 35220565
0
 

Author Closing Comment

by:bidgadget
ID: 35220586
Thank you very much.  Exactly what I needed.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question