Solved

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

Posted on 2010-09-15
3
273 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
  • 3
3 Comments
 
LVL 7

Accepted Solution

by:
whityum earned 500 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

821 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