title: how to convert a string value into integer in vb.net
body: <p><a href="https://i.stack.imgur.com/awnEh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/awnEh.png" alt="enter image description here"></a>Datatype of expense is int in Sql Server database Please Guide</p>
  
  <p>The Value of Expense which i got from the table expense</p>
  
  <pre><code>'Total Expenses B/W Dates
      sql = "select COALESCE (SUM (amount), 0) from tblexpense Where transactiondate &gt;= @p1 and transactiondate &lt;= @p2"
      CmdObj = New SqlCommand(sql, ConObj)
      CmdObj.Parameters.Add("@p1", SqlDbType.Date).Value = DateTimePicker1.Value.Date
      CmdObj.Parameters.Add("@p2", SqlDbType.Date).Value = DateTimePicker2.Value.Date
      CmdObj.ExecuteScalar()
      Dim sumexpense As Integer = CmdObj.ExecuteScalar
      LblExp.Text = "Rs. " &amp; sumexpense
  </code></pre>
  
  <p>Save Button to save The value of expense into table</p>
  
  <pre><code>Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
      ConObj = New SqlConnection(ConStr)
      ConObj.Open()
      Dim sql As String = "insert into tblbalance (tcon,pcon,ecoll,pendcoll,expense,bcoll,nprofit) values(@tcon,@pcon,@ecoll,@pendcoll,@expense,@bcoll,@nprofit)"
  
      With CmdObj
          .Parameters.Add("@tcon", SqlDbType.Int).Value = lblTcon.Text
          .Parameters.Add("@pcon", SqlDbType.Int).Value = LblPcon.Text
          .Parameters.Add("@ecoll", SqlDbType.Int).Value = LblEColl.Text
          .Parameters.Add("@pendcoll", SqlDbType.Int).Value = LblPColl.Text
          .Parameters.Add("@expense", SqlDbType.Int).Value = LblExp.Text
          .Parameters.Add("@bcoll", SqlDbType.Int).Value = LblBcoll.Text
          .Parameters.Add("@nprofit", SqlDbType.Int).Value = LblNet.Text
  
      End With
      CmdObj.Connection = ConObj
      CmdObj.ExecuteNonQuery()
      MsgBox("Saved Successfully")
      ConObj.Close()
  End Sub
  </code></pre>