title: ORA-01722: invalid number #2
body: <p>The error I had before was I can't insert NULL value into resources_id so I added resources_id into insert value to avoid this issue, but when I do it I get this error:</p>
  
  <blockquote>
    <p>ORA-01722: invalid number C#</p>
  </blockquote>
  
  <p>Line 56: <code>cmd.ExecuteNonQuery();</code>. </p>
  
  <p>WHat I did before to avoid this issue is I removed <code>not Null</code> and left everything null in my table and it works but it caused me other troubles which I found hard to solve, so I decided to go back to main issue and added <code>NOT NULL</code> to the resources_id in my database.
  Please help solve this issue.</p>
  
  <p>Another issue I have is resources_id in the parameters is not recognised</p>
  
  <p>MY CODE:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  using System.Data.OracleClient;
  using System.Configuration;
  using System.IO;
  
  
  
  public partial class Lecturer_upload_resources : System.Web.UI.Page
  {
      string strCon = "Data Source=****;Persist Security Info=True;User ID=****;Password=****;Unicode=false";
      protected void Page_Load(object sender, EventArgs e)
      {
          if (!IsPostBack)
          {
              BindGridviewData();
          }
      }
      // Bind Gridview Data
      private void BindGridviewData()
      {
          using (OracleConnection con = new OracleConnection(strCon))
          {
              using (OracleCommand cmd = new OracleCommand())
              {
                  cmd.CommandText = "select * from resource1";
                  cmd.Connection = con;
                  con.Open();
                  gvDetails.DataSource = cmd.ExecuteReader();
                  gvDetails.DataBind();
                  con.Close();
              }
          }
      }
      // Save files to Folder and files path in database
      protected void btnUpload_Click(object sender, EventArgs e)
      {
            string filename = Path.GetFileName(fileUpload1.PostedFile.FileName);
          Stream str = fileUpload1.PostedFile.InputStream;
          BinaryReader br = new BinaryReader(str);
          Byte[] size = br.ReadBytes((int)str.Length);
          using (OracleConnection con = new OracleConnection(strCon))
          {
              using (OracleCommand cmd = new OracleCommand())
              {
                  cmd.CommandText = "insert into resource1(Resources_id,FileName,fileType,Filedata) values(:Resources_id,:FileName,:FileType,:FileData)";
                  cmd.Parameters.AddWithValue(":Resources_id",Resources_id);
                  cmd.Parameters.AddWithValue(":FileName", filename);
                  cmd.Parameters.AddWithValue(":FileType", "application/word");
                  cmd.Parameters.AddWithValue(":FileData", size);
                  cmd.Connection = con;
                  con.Open();
                  cmd.ExecuteNonQuery();
                  con.Close();
                  BindGridviewData();
              }
          }
      }
  </code></pre>