Hi Tahir
Well , i gonna try to explain about how to save a odc file to a database
SAVING A FILE ON DATABASE:
First one , you must convert a Stream or File in a Compatible Data Type in SQl,
for this, there's a lot of ways to get this Byte Array. here is the function that i use to do this:
oDB.spExecNonQuery("spSaveFileToDataBase",New SqlParameter("@File", GetStreamAsByteArray(OpenFileDialog1.OpenFile)))
Private Function GetStreamAsByteArray(ByVal stream As System.IO.Stream) As Byte()
Dim streamLength As Integer = Convert.ToInt32(stream.Length)
Dim fileData As Byte() = New Byte(streamLength) {}
stream.Read(fileData, 0, streamLength)
stream.Close()
Return fileData
End Function
the function shown above return a Byte Array and this can be saved in a Binary Field in SQL Server
for this you can create a little module for select the desired file to saved. in HTML you can use a Browser object.
GET THE FILE
Well the way that i get the File or some object saved on My Data Base is with this code:
m_Paginas = oDb.spExecDataSet("spGetFile", _
New SqlParameter("@Prefijo", Prefijo), _
New SqlParameter("@Folio", Folio))
then, when i get the DataSet with the File (still in binary)
i convert it in File again:
Dim Page As DataRow = m_Paginas.Tables(0).Rows(0)
Dim AByte() As Byte = Page.Item("File")
Dim MS As New MemoryStream(AByte)
Right now, we have a meorystream and we can convert in a desired format.
If you need more help or information, please....tell us.
Best regards.