Actualy i want retrive doc(resume) file from database
I m devloping one project relate HR in which i want to insert the candidate informatin and his resume.
it is Inserting candidate informatin and his resume succesfully but when try to retrive his resume getting folling error
"Unable to cast object of type 'System.Decimal' to type 'System.Byte[]'."
Below is my code
Dim stream As New IO.MemoryStream()
Dim strcon As String = "Data Source=(local) ;Initial Catalog=HR; User ID=sa; Password=2605;"
Dim con As New SqlConnection(strcon)
Dim cmd As New SqlCommand("Select cReportType from mst_CandidateInfo where cReportType= @cReportType", con)
cmd.Parameters.Add(
"@cReportType", SqlDbType.VarChar)
cmd.Parameters(
"@cReportType").Value = TextBox1.Text
Dim obj As Byte() = {(CByte(cmd.ExecuteScalar()))}
Response.ContentType =
"Application/msword"
Response.BinaryWrite(
CType(cmd.ExecuteScalar(), Byte()))
Response.[End]()
con.Close()