Link to home
Start Free TrialLog in
Avatar of Ruffone
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
Avatar of BuggyCoder
BuggyCoder
Flag of India image

i would suggest two things here:-

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.
ASKER CERTIFIED SOLUTION
Avatar of Ruffone
Ruffone

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ruffone
Ruffone

ASKER

Thank you