Click here to Skip to main content
15,918,343 members

Comments by stefanere2k9 (Top 12 by date)

stefanere2k9 18-Mar-12 21:28pm View    
i have got this code now but it dont seem to be working;
SqlDataReader readdata;
sqlCommandWithdraw.Connection.Open();
decimal balance = decimal.Parse(Txt_Withdraw.Text);
decimal availableTBalance = 0.00M;
sqlCommandWithdraw.Parameters["@accountID"].Value = showaccounts.accountID;
readdata = sqlCommandWithdraw.ExecuteReader();
while (readdata.Read())
{
availableTBalance = (Convert.ToDecimal(readdata["balance"].ToString()) + Convert.ToDecimal(readdata["overdraftlimit"]));
}

sqlCommandWithdraw.Connection.Close();

if (availableTBalance >= balance)
{
sqlCommandUpdateBalance.Connection.Open();
availableTBalance -= balance;
sqlCommandUpdateBalance.Parameters["@balance"].Value = availableTBalance;
sqlCommandUpdateBalance.Parameters["@accountID"].Value = showaccounts.accountID;
sqlCommandUpdateBalance.ExecuteNonQuery();
sqlCommandUpdateBalance.Connection.Close();
stefanere2k9 14-Mar-12 11:56am View    
winforms and logtableadapter1 is a dataadapter which contains the table
stefanere2k9 13-Mar-12 19:33pm View    
WinForms
stefanere2k9 9-Mar-12 14:54pm View    
on the table i got ID, cardNumber, amount, date. i only want to display the cardnumber that i have passed from form1. am not sure how to do this as i havent worked with datagrid before
stefanere2k9 7-Mar-12 15:59pm View    
sorry for wasting your time i was passing the wrong data over. Now it working fine. what i need to do aswell i want to display available balance where balance + overdraftLimit how would i do that