Click here to Skip to main content
16,004,602 members

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.