# Visual Basic > Visual Basic .NET >  Inset integer values to access db

## Tajaldeen

Hi guys, i'm new to VB down to the basic level, i have a VB form linked to access db which i can insert data throught it directly to access db using NumericUpDown to provide the value , the problem is that its only insert text values eventhough i changed the vlues into numbers in access db so when i press insert it show error message that The data type does not match in the criteria expression.
here is the code



```

  Public Sub October()

        Dim Sql As String
        Dim cn1 As OleDbConnection
        cn1 = New OleDbConnection
        cn1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=false;Data Source=../debug/testdb.mdb"
        cn1.Open()

        Dim cmd2 As New OleDbCommand

        Dim Id2 As String = ComboBox2.Text
        Dim Oct2 As String = NumericUpDown1.Value
        If IsIDExist(ComboBox2.Text) = True Then
            Sql = "Update tbl_accounts set Oct='" & Oct2 & "', ID='" & Id2 & "' Where ID ='" & Id2 & "' "
        Else
            Sql = "INSERT INTO tbl_accounts (ID,Oct)Values('" & Id2 & "','" & Oct2 & "')"
        End If

        If ComboBox1.Text = "October" Then
            DatabaseConnect()

            With cmd2
                .Connection = cn1
                .CommandText = Sql
                .Parameters.Clear()

                .ExecuteNonQuery()
                MsgBox("data saved seccussfuly", MsgBoxStyle.Information, "warning")
                NumericUpDown1.Value = 0
            End With
        End If
        cn1.Close()

    End Sub
```

----------


## OptionBase1

In both your Update and Insert SQL statements, you are surrounding all your values with single quotes (' characters).  For numeric values, don't do that.

This is wrong:



```
Update table_name set numericField='1' ...
```

This is right:



```
Update table_name set numericField=1 ...
```

----------


## jmcilhinney

SQL works just like VB in that Strings get quoted and numbers don't. That said, this should not be an issue in the first place because you should not be building SQL code using string concatenation like that. Do it properly and use parameters and this is one of several problems that goes away. Follow the Blog link in my signature and check out the post on Parameters in ADO.NET to learn how.

----------


## Tajaldeen

Thank you very much, you solved the problem amazingly  :wave:

----------


## Tajaldeen

> In both your Update and Insert SQL statements, you are surrounding all your values with single quotes (' characters).  For numeric values, don't do that.
> 
> This is wrong:
> 
> 
> 
> ```
> Update table_name set numericField='1' ...
> ```
> ...


Thank you very much, you solved the problem amazingly

----------


## .paul.

```
Dim Oct2 As String = NumericUpDown1.Value
```

That shouldn't be a String. NumericUpDown1.Value is a Decimal. If you intend to use an Integer (whole number)...



```
Dim Oct2 As Integer = CInt(NumericUpDown1.Value)
```

----------

