Ruffone
asked on
Upload files data and Info to the database
I have a method in my repository that uses the command object to add files data and Info to the database. I have 2 pages that uses this method. One page works every time 100% of the time. The second location never works. I have being dealing with this for a c full 24 hours now. The script fails when I attempt the retrieval of the output ID (fileId). I get the “Object reference not set to an instance of an object.” What I don’t understand is why it works from one page and not the other. I could really use your insight
Thank you
uploadsql.txt
Thank you
uploadsql.txt
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you
1. i could see transaction code with only commit, there is no rollback option.
2. Why would you need to use sqluploadstream, you can write your binary/buffer of bytes directly to sql server using ExecuteNonQuery. It will be much easier and straight forward.
Also please ensure that you are closing the connection after using, and every DB Write is opening up new connection. This exception generally happens when you try to use disposed object.