Thread: Over my head
View Single Post
  #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" />[i]Originally posted by Smokie[/i]
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:
[b]asp.net[/b] -
<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>
[b]vb.net[/b]
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
[b]Error Message[/b]
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