Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>From your Comments </p> <blockquote> <p>the nOofTrips column doesn't update anymore</p> </blockquote> <p>your <code>nOofTrips</code> column is <code>int</code> so you should not give single quotes.</p> <p><strong>Try This:</strong></p> <pre><code>command.CommandText = "UPDATE [tbl_bill_addtrips] SET nOofTrips= " + Trips.ToString() + " where RouteFrom='" + this.txtBillRouteFrom.Text + "'and RouteTo='" + this.txtBillRouteTo.Text + "'"; </code></pre> <p><strong>Note :</strong> I Suggest you to use parameterised queries to avoid Sql Injection Attacks.</p> <p><strong>With Parameterised Queries:</strong></p> <pre><code>command.CommandText = "UPDATE [tbl_bill_addtrips] SET nOofTrips=@nooftrips where RouteFrom=@routefrom and RouteTo=@routeto"; command.Parameters.AddWithValue("@nooftrips",Trips); command.Parameters.AddWithValue("@routefrom",this.txtBillRouteFrom.Text); command.Parameters.AddWithValue("@routeto",this.txtBillRouteTo.Text); </code></pre> <p><strong>Solution 2:</strong> Try this: </p> <pre><code>command.CommandText = "UPDATE tbl_bill_addtrips SET nOofTrips= " + Trips.ToString() + " where RouteFrom='" + this.txtBillRouteFrom.Text.Trim() + "' and RouteTo='" + this.txtBillRouteTo.Text.Trim() + "'"; </code></pre> <p><strong>Solution 3:</strong> </p> <p>Replace this:</p> <pre><code>if (From.ToString() == txtBillRouteFrom.Text &amp;&amp; to.ToString() == txtBillRouteTo.Text) </code></pre> <p>With This:</p> <pre><code>if (From.ToString().Equals(txtBillRouteFrom.Text.Trim()) &amp;&amp; to.ToString().Equals(txtBillRouteTo.TextTrim())) </code></pre>
 

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