422,139 Members | 1,268 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 422,139 IT Pros & Developers. It's quick & easy.

how can i convert integer to string

P: 2
I have a school project and I need to convert sasia(quantity),cmimi(price) to string...can anyone help me please?
Expand|Select|Wrap|Line Numbers
  1. Public Sub executeyourquery(ByVal query As String)
  2.         Dim cmd As New SqlCommand(query, con)
  3.         cmd.Parameters.AddWithValue("@produkt_id", txtID.Text)
  4.         cmd.Parameters.AddWithValue("@emertimi", txtEmertimi.Text)
  5.         cmd.Parameters.AddWithValue("@sasia", txtSasia.Text)
  6.         cmd.Parameters.AddWithValue("@cmimi", txtCmimi.Text)
  7.         cmd.Parameters.AddWithValue("@vlera", txtVlera.Text)
  8.         cmd.Parameters.AddWithValue("@furnitor_id", txtF.Text)
  9.         con.Open()
  10.         cmd.ExecuteNonQuery()
  11.         con.Close()
  12.     End Sub
1 Week Ago #1
Share this Question
Share on Google+
2 Replies

Expert Mod 5K+
P: 9,727
What error are you getting?

Assuming your txtSasia is a TextBox, then txtSasia.Text is already a string.

Do you want to convert that into an Integer?
Use the Integer.TryParse Method...
Expand|Select|Wrap|Line Numbers
  1. Dim sasiaInt As Integer
  2. Integer.TryParse(txtSasia.Text, sasiaInt )
  3. cmd.Parameters.AddWithValue("@sasia", sasiaInt)
  4. Dim cmimiInt As Integer
  5. Integer.TryParse(txtCmimi.Text, cmimiInt )
  6. cmd.Parameters.AddWithValue("@cmimi", cmimiInt )
1 Week Ago #2

P: 2
Thanks Frinavale
i had forgot .Text ...Now its ok
1 Week Ago #3

Post your reply

Sign in to post your reply or Sign up for a free account.