VB.NET

Moderators: seancampbell
Number of threads: 4022
Number of posts: 10035

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
How to update data using a radio button Posted by Akaglo on 19 Jul 2012 at 1:51 PM
The following code doesn't execute and doesn't give any message. I'd be glad if someone could edit it for me.

Try
Dim qry, subject As String
If rbnCore.Checked = True Then
subject = "Core"
Else : subject = "Elective"
End If
qry = "Update ProgramDetails.Subjects set SubjectName=@SubjectName,SubjectType=@SubjectType,UserID=@UserID,UserName=@UserName,Password=@Password where SubjectCode='" & txtSubjectCode.Text & "'"
cmd = New SqlCommand(qry, cn)
cmd.Parameters.Add(New SqlParameter("@SubjectCode", txtSubjectCode.Text))
cmd.Parameters.Add(New SqlParameter("@SubjectName", txtSubName.Text))
cmd.Parameters.Add(New SqlParameter("@SubjectType", subject))
cmd.Parameters.Add(New SqlParameter("@UserID", txtUserName.Text))
cmd.Parameters.Add(New SqlParameter("@Password", txtPassword.Text))
cmd.ExecuteNonQuery()
MessageBox.Show("Record successfully updated", "Updated", MessageBoxButtons.OK, MessageBoxIcon.Information)
showgrid()
Catch ex As Exception
End Try



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.