Hi,

I have 1 textbox and button to insert value into sql server database 2008. But the problem is in database it not appear correctly when had zero front of value....example :- 00001.....in database just appear 1...i try to use nvarchar,varchar,nchar but still same...]

Can anyone guide me...tq

If you store a string "00001" in the database it will be saved as "00001"

Dim strSQL As String
Dim ValueStr As String

ValueStr = "00001"

' Store as a string
strSQL = "INSERT INTO <mytable> (<mytextfield>) VALUES ('" & ValueStr & "')"

What may cause your problem is not in the code which stores the value to DB. Do you have any code similar to

Dim ValueInt As Integer
ValueInt = CInt(TextBox1.Text)

which might convert the content of the text box to any numerical value before inserting it to the DB? That would explain loosing the leading zeroes.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.