0

Hi

sir i m new in vb.net . i want to add product record , in text box i enter packing 25's but 25's not add in table , when i change it 25s it saved. but my requirement is to save 25's. what i do

thanks
zia

5
Contributors
4
Replies
21
Views
4 Years
Discussion Span
Last Post by M.Waqas Aslam
0

It's quite hard to understand what you're wanting. The problem could lie where you're setting datatable property. But if it's not, I suggest to dim a string first, insert later:

Dim Prdt as String
Prdt = TextBox1.Text.Trim
YourDataTable.Rows.Add(Prdt,Col1Value,Col12Value...)
0

To escape a single quote and other escape sequence chars, you need to use parameterized sql statement (SqlParameter, OleDbParameter etc).

Using cn As New SqlConnection(cnStr) 
    Dim sql = "INSERT INTO tableOne (col1) VALUES (@col1)"
    Using cmd as new SqlCommand(sql,cn)
       cmd.Parameters.AddWithValue("@col1","25's")
       cn.Open()
       cmd.ExecuteNonQuery()
       cn.Close()
    End Using
End Using
-1

i think if your column datatype is not supported to 20's , if you are using mssql server then nvarchar datatype may help .

Regards

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.