Note that there are some explanatory texts on larger screens.

plurals
  1. POIf not Check then Add to Cash
    text
    copied!<p>This is probably simple, atleast I am hoping, but I am having feats with it.</p> <p>I have 5 textboxes for entering check amount in StepA.</p> <p>If what I enter in StepA is check Amount, the same amount entered, goes to StepB.</p> <p>If what I enter in StepA is cash only, it does not go to StepB. I stays in StepA only.</p> <p>So far so good because it works.</p> <p>No box for entering cash. However, we have cash fieldname on the db.</p> <p>We we would like to do is to find a way to insert the amount entered for Check into check fieldname in the DB and the cash into cash fieldname.</p> <p>So far, we are inserting '' (empty string) into cash field.</p> <p>I can't wrap around my head, how to handle this.</p> <p>Any help would be greatly appreciate.</p> <p>Here is the relevant code. As you can see from the code, this --> </p> <pre><code>*chckval = GridView1.FindControl("chck" &amp; CStr(x)) represents check.* For x = 1 To 5 Step 1 dedval = GridView1.FindControl("ded" &amp; CStr(x)) chckval = GridView1.FindControl("chck" &amp; CStr(x)) chcknumval = GridView1.FindControl("chcknum" &amp; CStr(x)) onetimeval = GridView1.FindControl("onetime" &amp; CStr(x)) multival = GridView1.FindControl("multi" &amp; CStr(x)) If dedval.Text &lt;&gt; "-1" And donatechoice.SelectedItem.Value &lt;&gt; "No" Then sql += "INSERT INTO EmpTable (employee_id, charity_code, check_amt, chcknum, one_time, bi_weekly, cash, donate_choice, date_stamp) " sql += "VALUES ('" &amp; employee_idLabel.Text &amp; "','" &amp; dedval.SelectedValue &amp; "','" &amp; chckval.Text &amp; "','" &amp; chcknumval.Text &amp; "','" &amp; onetimeval.Text &amp; "','" &amp; multival.Text &amp; "','','" &amp; donatechoice.SelectedItem.Value &amp; "','" &amp; datestamp &amp; "');" End If </code></pre> <p>I forgot to mention that users are required to enter check# for anybox that has a checkamount. Not sure if that helps. </p> <p>What I am thinking, as a possible solution, is that since there are 5 checkboxes, and a user must check a box to indicate the amount being paid is for check, I am thinking of constructing something like:</p> <p>If checkbox.checked and the associated check textbox is not empty, Then ' this is for check, add it to check fieldname insert.... else ' even though the associated check textbox is not empty, the checkbox isn't checked. Therefore, this must be cash, insert into cash fieldname end if. I just don't know the correct syntax.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload