Solved

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

Posted on 2010-09-15
3
277 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 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

617 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