title: ERROR [22P02] ERROR: invalid input syntax for integer: "";
body: <p>Never seen such error:</p>
  
  <blockquote>
    <p>ERROR [22P02] ERROR: invalid input syntax for integer: ""; Error while executing the query</p>
  </blockquote>
  
  <p>Creating table:</p>
  
  <pre><code>    Public Function PrimkCreate(ByVal myPrimkTable As String, ByVal nCon As OdbcConnection) As Integer
      Dim ans As Integer
      Dim cCommand As OdbcCommand = New OdbcCommand("CREATE TABLE IF NOT EXISTS " + myPrimkTable + "(" &amp; _
              "prm_id int NOT NULL, " &amp; _
              "pkni text, " &amp; _
              "pdatum text, " &amp; _
              "pdatumnaplate text, " &amp; _
              "pdanaodgode int, " &amp; _
              "puldok text, " &amp; _
              "puldokbroj text, " &amp; _
              "pdatumk text, " &amp; _
              "pvrijemek text, " &amp; _
              "pdobid int, " &amp; _
              "pdoboib text, " &amp; _
              "pnabc double precision, " &amp; _
              "purab double precision, " &amp; _
              "ppdv double precision, " &amp; _
              "ppnak double precision, " &amp; _
              "pprodc double precision, " &amp; _
              "pvrstaprimke int, " &amp; _
              "pzapisniktekst text, " &amp; _
              "prez text, " &amp; _
              "CONSTRAINT " &amp; myPrimkTable &amp; "_pkey PRIMARY KEY(prm_id))", nCon)
  
      ans = cCommand.ExecuteNonQuery()
      cCommand.Dispose()
      Return ans
  End Function
  </code></pre>
  
  <p>Update code:</p>
  
  <pre><code>    Public Function update_LPrimk(ByRef primk As Integer, ByVal mCon As OdbcConnection) As Integer
  
      Dim retval As Integer
      Dim uCmd As OdbcCommand = New OdbcCommand("UPDATE " &amp; myPrimkTable &amp; " SET " &amp; _
                  "prm_id=" &amp; primk &amp; ", " &amp; _
                  "pkni='" &amp; prm.pKni &amp; "', " &amp; _
                  "pdatum='" &amp; prm.pDatum &amp; "', " &amp; _
                  "pdatumnaplate='" &amp; prm.pDatumNaplate &amp; "', " &amp; _
                  "pdanaodgode=" &amp; prm.pDanaodgode &amp; ", " &amp; _
                  "puldok='" &amp; prm.pUlDok &amp; "', " &amp; _
                  "puldokbroj='" &amp; prm.pUlDokBroj &amp; "', " &amp; _
                  "pdatumk='" &amp; prm.pDatumk &amp; "', " &amp; _
                  "pvrijemek='" &amp; prm.pVrijemek &amp; "', " &amp; _
                  "pdobid='" &amp; prm.pDobID &amp; "', " &amp; _
                  "pdoboib='" &amp; prm.pDobOib &amp; "', " &amp; _
                  "pnabc='" &amp; Replace(prm.pNabc.ToString, ",", ".") &amp; "', " &amp; _
                  "purab='" &amp; Replace(prm.pURab.ToString, ",", ".") &amp; "', " &amp; _
                  "ppdv='" &amp; Replace(prm.pPdv.ToString, ",", ".") &amp; "', " &amp; _
                  "ppnak='" &amp; Replace(prm.pPnak.ToString, ",", ".") &amp; "', " &amp; _
                  "pprodc='" &amp; Replace(prm.pProdc.ToString, ",", ".") &amp; "', " &amp; _
                  "pvrstaprimke=" &amp; prm.pVrstaPrimke &amp; ", " &amp; _
                  "pzapisniktekst='" &amp; prm.pZapisnikTekst &amp; "', " &amp; _
                  "prez='" &amp; prm.pRez &amp; "' " &amp; _
                  "WHERE prm_id=" + primk.ToString, mCon)
  
      retval = uCmd.ExecuteNonQuery()
      uCmd.Dispose()
      Return retval
  End Function
  </code></pre>
  
  <p>Query looks exactly like this:</p>
  
  <pre><code>UPDATE primke SET prm_id=1, pkni='U', pdatum='07.01.2013', pdatumnaplate='10.01.2013',
  pdanaodgode=3, puldok='ghkzug gugug', puldokbroj='jkhk', pdatumk='', pvrijemek='', 
  pdobid='', pdoboib='', pnabc='0', purab='0', ppdv='0', ppnak='0', pprodc='0', 
  pvrstaprimke=0, pzapisniktekst='', prez='' WHERE prm_id=1
  </code></pre>
  
  <p>I have many tables where I run similar commands but have never seen such an error.<br>
  What might be the problem?</p>