16,004,602 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Member 14814400 (Top 12 by date)
Member 14814400
3-May-20 8:44am
View
Sure!!
Member 14814400
3-May-20 3:06am
View
THANK YOU!! I HAVE IT REVISED AND IT IS NOW WORKING,
THIS IS NOW THE CODE THAT I AM RUNNING
Dim FundsNeeded As Integer = Val(TextBoxTotal.Text)
Dim FundsAvailable As Integer = Val(LabelWallet.Text)
Dim NewWalletValue As Integer = 0
Dim UserName = FormLogin.TxtBoxUsername.Text
'I change it so it can get the username in the database'
Dim qryWalletRetrieve As String = "SELECT wallet FROM TblMemberships WHERE Username = @username"
Dim qryWalletUpdate As String = "UPDATE TblMemberships SET wallet = @wallet WHERE Username= @username"
Dim cmd As New SqlCommand(qryWalletRetrieve, con)
cmd.Parameters.AddWithValue("@username", UserName)
con.Open()
FundsAvailable = Convert.ToInt32(cmd.ExecuteScalar())
If (FundsAvailable < FundsNeeded) Then
MsgBox("Insufficient wallet, please load!", MsgBoxStyle.Information, "Wallet")
Else
NewWalletValue = FundsAvailable - FundsNeeded
cmd.CommandText = qryWalletUpdate
cmd.Parameters.AddWithValue("@wallet", NewWalletValue)
Dim RA As Integer = cmd.ExecuteNonQuery() ' RA = Rows Affected
If RA = 1 Then
MsgBox("Successfully ordered!", MsgBoxStyle.ApplicationModal, "Wallet")
Else
' Oops... why are we here?
End If
End If
cmd.Dispose()
con.Close()
Member 14814400
3-May-20 1:16am
View
unfortunately, not yet. :(
Member 14814400
3-May-20 1:15am
View
where can i find it?
Member 14814400
2-May-20 9:30am
View
The remaining errors are with this:
Int RA = cmd.ExecuteNonQuery() ' RA = Rows Affected
If RA = 1 Then
the error description is:
Severity Code Description Project File Line Suppression State
Error BC30451 'RA' is not declared. It may be inaccessible due to its protection level.
Member 14814400
2-May-20 9:26am
View
i can't seem to find the issue in the said error above, thank you though!!
Member 14814400
2-May-20 9:14am
View
there are errors in this lines
FundsAvailable = (Int)cmd.ExecuteScalar()
and
Int RA = cmd.ExecuteNonQuery() ' RA = Rows Affected
If (RA = 1) Then
sorry, Our prof are unable to taught this due to the pandemic. Thank you!
Member 14814400
2-May-20 9:04am
View
i did, i tried everything i know and it is till not working.
Member 14814400
2-May-20 8:45am
View
my code that add data into wallet is varchar, i changed it to money and now it gives me this error Failed to convert parameter value from a String to a Decimal.
Member 14814400
2-May-20 8:40am
View
I tried and it does not work, the labelwallet.text returns to 0 after i press the button. And it still said Insufficient wallet, please load! even if wallet > total
Member 14814400
2-May-20 8:10am
View
I also tried using the sqlcommand insert and use table.rows to deduct but I don't know how to update it afterwards.
Member 14814400
2-May-20 7:41am
View
Yes, and I also tried changing its data type in sql as money and as smallmoney
Show More