C# 如何使用Angular 7下载作为varbinary类型存储在SQL Server数据库中的文件?

C# 如何使用Angular 7下载作为varbinary类型存储在SQL Server数据库中的文件?,c#,sql-server,angular,typescript,download,C#,Sql Server,Angular,Typescript,Download,我正在尝试下载一个文件,该文件以vrabinary类型存储在sql server数据库表中,使用typscipt angula 7 我能够从数据库中获取文件名和文件内容为varbinay类型的对象(res) public下载=(fileId)=>{ this.fileService.getFilediaById(fileId) .订阅(res=>{ this.isLoading=false; 如果(res!=null) { const data=res.fileContent;//类型为var

我正在尝试下载一个文件,该文件以vrabinary类型存储在sql server数据库表中,使用typscipt angula 7

我能够从数据库中获取文件名和文件内容为varbinay类型的对象(res)

public下载=(fileId)=>{
this.fileService.getFilediaById(fileId)
.订阅(res=>{
this.isLoading=false;
如果(res!=null)
{
const data=res.fileContent;//类型为varbinary
const filename=res.filename;
constblob=newblob([data],{type:'application/pdf'});
this.fileUrl=this.sanitizer.bypassSecurityTrustResourceUrl(window.URL.createObjectURL(blob));
}
},
错误=>{
console.log(错误);
});
}

窗口。打开(this.fileUrl,'.'u blank')
试试这个hi,@JohnVelasquez我试过了,但没用。它给出了一个错误,上面写着(error TypeError:_co.alert不是一个函数)你在这行的哪一部分添加了代码hi,@JohnVelasquez I在写着“this.fileUrl=this.sanitizer.by…”的那一行后面添加了代码。你能不能包括一个错误
window.open(this.fileUrl,'.\u blank')
试试这个,@JohnVelasquez我试过了,但没用。它给出了一个错误,上面写着(error TypeError:_co.alert不是一个函数)你在这行的哪一部分添加了代码hi,@JohnVelasquez我在写着“this.fileUrl=this.sanitizer.by…”的那一行后面添加了代码。你能包括一个错误的屏幕截图吗