How to insert blob in SQL Server without loading and using ASP?

I need to upload the files to a SQL Server database.

I need a solution that does not include bulk inserts .

+3
source share
1 answer
Set ObjStr = Server.CreateObject("ADODB.Stream")
ObjStr.Type = 1 'AdBinary
ObjStr.Open

ObjStr.LoadFromFile "D:\file.pdf"

'Evita sql inject
Set oPreparedStatementADO              = Server.CreateObject("ADODB.Command")
oPreparedStatementADO.ActiveConnection = conexao
cSql = "INSERT INTO edital_editais(blob_field) values (?); "


oPreparedStatementADO.CommandText = cSQL

x = ObjStr.Read

oPreparedStatementADO.Parameters.Item(0) = x

set rs = oPreparedStatementADO.Execute
+2
source

Source: https://habr.com/ru/post/1792539/


All Articles