Solved

vb.net 4  asp.net 4 web sql parameter

Posted on 2011-03-25
2
261 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 13

Accepted Solution

by:
Rahul Agarwal 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

627 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