Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Getting the text from file upload control to insert into a database

Posted on 2010-09-15
3
Medium Priority
?
278 Views
Last Modified: 2012-05-10
I'm getting this error when trying to get the name of a file to upload then insert the text into a table in my db.

Error: String or binary data would be truncated. Cannot insert the value NULL into column 'imgID'

i want to get the name of the files from these two file upload controls.

cmd.Parameters.AddWithValue("@img1", FileUpload1.ToString)
cmd.Parameters.AddWithValue("@img2", FileUpload2.ToString)
0
Comment
Question by:nickrjsmith
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
3 Comments
 
LVL 7

Accepted Solution

by:
whityum earned 2000 total points
ID: 33685649
fuAddContacts.FileName.ToString()
0
 
LVL 7

Expert Comment

by:whityum
ID: 33685655
oops, pasted from my own code, yours would be:
FileUpload1.FileName.ToString()
0
 
LVL 7

Expert Comment

by:whityum
ID: 33685660
so combined:
cmd.Parameters.AddWithValue("@img1", FileUpload1.FileName.ToString())
cmd.Parameters.AddWithValue("@img2", FileUpload2.FileName.ToString())
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question