Over my head

This is a discussion on "Over my head" within the Introduce Yourself section. This forum, and the thread "Over my head are both part of the Community category.



Go Back   Webforumz.com > Community > Introduce Yourself

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Nov 3rd, 2004, 10:03
moragskene1@aol.com
Guest
Posts: n/a
Over my head

Hello, I have just joined the forum. I am a newbie IT Developer using visual studio.net. I am tyring to write system so that users can upload documents to an SQL database (which would be stored as an image). If anybody knows any good articles/examples of this I would love to hear from you. Using an input box to obtain the file, the database seems to reject it.

Your help would be appreciated. I am about to search the archives for anything similar.
Reply With Quote

  #2 (permalink)  
Old Nov 3rd, 2004, 13:12
Highly Reputable Member
Join Date: Jul 2003
Location: Ipswich, UK
Posts: 690
Thanks: 0
Thanked 0 Times in 0 Posts
Hi, welcome to the forumz, can you post the error message from your ASP.NET page? ..or maybe show us the code you are using?
Reply With Quote
  #3 (permalink)  
Old Nov 3rd, 2004, 13:48
moragskene1@aol.com
Guest
Posts: n/a
<blockquote id="quote" class="ffs">quote:<hr height="1" noshade="noshade" id="quote" />Originally posted by Smokie
Hi, welcome to the forumz, can you post the error message from your ASP.NET page? ..or maybe show us the code you are using? <hr height="1" noshade="noshade" id="quote" /></blockquote id="quote">

I am so very new to this, so you will see my code is very basic:
asp.net -
<form id="Form1" method="post" encType="multipart/form-data" runat="server">
<INPUT id="Upload" style="Z-INDEX: 101; LEFT: 112px; POSITION: absolute; TOP: 136px" type="file"
name="content" runat="server"><asp:button id="UploadButton" style="Z-INDEX: 104; LEFT: 112px; POSITION: absolute; TOP: 176px"
runat="server" Text="Upload" Width="224px"></asp:button></form>
vb.net
Private Sub UploadButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UploadButton.Click

Dim conn As New SqlConnection("integrated security=SSPI;data source=...... etc etc)

conn.Open()

Dim myCommand As New SqlCommand("proc_UploadDocuments", conn)
myCommand.CommandType = CommandType.StoredProcedure

Dim parameterContent As New SqlParameter("@Content", SqlDbType.Image, 16)
parameterContent.Value = Upload.PostedFile

myCommand.Parameters.Add(parameterContent)

myCommand.ExecuteNonQuery()
conn.Close()
End Sub
Error Message
System.InvalidCastException: Object must implement IConvertible.
If you can offer any help on this (or code) I would really really appreciate it!

Thanks

Morag
Reply With Quote
  #4 (permalink)  
Old Nov 4th, 2004, 10:48
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,952
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Send a message via MSN to Rob Send a message via Skype™ to Rob
Morag.... you would be far better storing the image on the webserver and storing the location of that image in the database. This will make serving images 100 times easier.

Is there any specific reason why you would want to store the image inside SQL?
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
Reply With Quote
  #5 (permalink)  
Old Nov 4th, 2004, 13:22
moragskene1@aol.com
Guest
Posts: n/a
Hi, I would be storing many files and images using the 'image' column on the database, I thought it would be better to save on space on the server? I wanted more control over each document, and then have an archive table in the database too.
Reply With Quote
  #6 (permalink)  
Old Nov 4th, 2004, 16:50
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,952
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Send a message via MSN to Rob Send a message via Skype™ to Rob
sure..... you are saving space on the web server.... but decreasing space on your SQL server.
Webspace is generally far cheaper than SQL space.
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
Reply With Quote
  #7 (permalink)  
Old Nov 5th, 2004, 11:39
Highly Reputable Member
Join Date: Jul 2003
Location: Ipswich, UK
Posts: 690
Thanks: 0
Thanked 0 Times in 0 Posts
The problem resides here.

SqlDbType.Image is an Array of type Byte, which is a variable-length stream
of binary data ranging from 0 to 231 -1 (or 2,147,483,647) bytes.

System.Array is declared as:

[Visual Basic]
<Serializable>
MustInherit Public Class Array
Implements ICloneable, IList, ICollection, IEnumerable
[C#]
[Serializable]
public abstract class Array : ICloneable, IList, ICollection,
IEnumerable

We can see that System.Array does not implement IConvertible at all.

I think you should not use the way you are using now to update an IMAGE
column. Please read the following KB article.

Q308042 HOW TO: Read and Write BLOB Data by Using ADO.NET with Visual Basic
.NET,
http://support.microsoft.com/support.../q308/0/42.asp.

HTH.
Reply With Quote
  #8 (permalink)  
Old Nov 28th, 2004, 17:44
adam
Guest
Posts: n/a
I am way over my head. I can't figure out how to create a button in Fireworks and move it into Dreamweaver. I saved the file, but it looks like I saved it 8 or 9 times when I look in the panel in Dreamweaver.. When I insert it into Dreamweaver, the button does not show up.

Ug
adam
Reply With Quote
  #9 (permalink)  
Old Nov 29th, 2004, 07:20
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
adam, Welcome to the Forums, but your post is completly unrelated to this thread. Please make a new thread in future.

I don't have Fireworks but I believe that by default is saves in PNG format with a lot of layer data, etc, that most other programs and web browsers will not like. You can also use the export option on the File menu to save the file for the web, as either GIF or JPG and one of those files should definetly appear in Dreamweaver when you import. JPG is the safer choice if your image has a lot of colours.
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
I seem to have gotten in over my head. GregoryV Starting Out 10 May 28th, 2007 00:53
No </HEAD> tag? cj550 Web Page Design 4 May 11th, 2007 21:07
Head scratcher.... minute44 Web Page Design 5 Jun 2nd, 2006 14:56
head message csa Web Page Design 1 Jan 17th, 2006 12:30
I am in way over my head!!! Can someone please help!? blh9901 Introduce Yourself 15 Aug 15th, 2005 21:21


All times are GMT. The time now is 10:31.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43