Connection:
Public Shared Sub SQLExecute(ByVal strSQL As String)
Dim Conn As New SqlConnection(getConnectionString)
Dim cmd As New SqlCommand(strSQL, Conn)
With cmd
.Connection.Open()
.ExecuteNonQuery()
.Connection.Close()
.Dispose()
End With
End Sub
Public Sub add()
DBHelper.SQLExecute("insert into emp(empno,ename,sal,deptno) values (" & Empno & ",'" & Ename & "'," & Sal & "," & Deptno & ")")
End Sub
I am using the above code to insert the row in sqlserver db.
When i am trying to insert with empno as NULL which is of integer type it storing as 0.
Please help me to store the NULL in the database.
Enter your message below
Sign in or Join us (it's free).