3

I need to upload files 'into' a SQL Server database.

I need a solution that doesn't involve bulk inserts.

3

1 Answer 1

2
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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.