My problem SQL script:
set @filepath = 'E:\foto\1.jpg'
INSERT INTO [dbo].[MsQuestions] ([TestCategoryID], [LevelID], [TestTypeID], [QuestionText], [QuestionImg])
select 1 , 1, 8, 'data gambar',BulkColumn FROM OPENROWSET(BULK @filepath , SINGLE_BLOB)
thanks.
<%@ Page Language="C#" %><%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%
string sConn = @"server=.; database=OnlineTesting; Integrated Security=True";
SqlConnection objConn = new SqlConnection(sConn);
objConn.Open();
string sTSQL = "exec sp_filenamea";
SqlCommand objCmd = new SqlCommand(sTSQL, objConn);
objCmd.CommandType = CommandType.Text;
SqlDataReader dr = objCmd.ExecuteReader();
dr.Read();
Response.BinaryWrite((byte[])dr["QuestionImg"]);
objConn.Close();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Exec SP</title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>