T
Terry
Hello:
Using vb.net 3.5
I have a sql table with a binary field (sql 2000)
This is for a word document.
to insert into sql, I use
Dim fs As New System.IO.FileStream(FileNameandPath, IO.FileMode.Open,
IO.FileAccess.Read)
Dim b(fs.Length() - 1) As Byte
fs.Read(b, 0, b.Length)
fs.Close()
call stored procedure
Dim q As New SqlParameter("@BLOB", SqlDbType.Binary, b.Length,
ParameterDirection.Input, False, 0, 0, Nothing, DataRowVersion.Current, b)
-> I can see that something is inserted into the table.
to get the document, I call another stored procedure
Dim dr As SqlDataReader = cmd.ExecuteReader()
Dim buffer As Byte() =
System.Text.Encoding.Default.GetBytes(cmd.ExecuteScalar())
Dim fs As New FileStream(DesktopPath + "/" + Var_NewFileName,
FileMode.Create)
fs.Write(buffer, 0, buffer.Length)
fs.Close()
When I do this, a file is created but it is either empty or I get prompted
for the encoding...
Any suggestions ?
Thanks
Using vb.net 3.5
I have a sql table with a binary field (sql 2000)
This is for a word document.
to insert into sql, I use
Dim fs As New System.IO.FileStream(FileNameandPath, IO.FileMode.Open,
IO.FileAccess.Read)
Dim b(fs.Length() - 1) As Byte
fs.Read(b, 0, b.Length)
fs.Close()
call stored procedure
Dim q As New SqlParameter("@BLOB", SqlDbType.Binary, b.Length,
ParameterDirection.Input, False, 0, 0, Nothing, DataRowVersion.Current, b)
-> I can see that something is inserted into the table.
to get the document, I call another stored procedure
Dim dr As SqlDataReader = cmd.ExecuteReader()
Dim buffer As Byte() =
System.Text.Encoding.Default.GetBytes(cmd.ExecuteScalar())
Dim fs As New FileStream(DesktopPath + "/" + Var_NewFileName,
FileMode.Create)
fs.Write(buffer, 0, buffer.Length)
fs.Close()
When I do this, a file is created but it is either empty or I get prompted
for the encoding...
Any suggestions ?
Thanks