Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

vb.net 4  asp.net 4 web sql parameter

Posted on 2011-03-25
2
Medium Priority
?
269 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 2000 total points
ID: 35220565
0
 

Author Closing Comment

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

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

715 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