System.Data.OleDb.OleDbException:处理命令时出现一个或多个错误。ORA-00936: 缺少表达式
这是我得到的错误。有什么建议么?
我的 ashx 处理程序代码是:
public class Handler1 : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
OracleConnection conn = new OracleConnection("Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVER_NAME=XE)));User Id=sakthi_studdb;Password=sakthi;");
OracleCommand cmd = new OracleCommand();
cmd.CommandText = "Select IMG_NAME, IMG_IMAGE from MYIMGTABLE where IMG_ID =:IMG_ID";
cmd.CommandType = System.Data.CommandType.Text;
cmd.Connection = conn;
OracleParameter ImageID = new OracleParameter(":IMG_ID",OracleDbType.Int32);
ImageID.Value = context.Request.QueryString["IMG_ID"];
cmd.Parameters.Add(ImageID);
conn.Open();
OracleDataReader dReader = cmd.ExecuteReader();
dReader.Read();
context.Response.BinaryWrite((byte[])dReader["IMG_IMAGE"]);
dReader.Close();
conn.Close();
}
public bool IsReusable
{
get
{
return false;
}
}
}
我的 aspx 代码是:
<asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1" AutoGenerateColumns="False" DataKeyNames="IMG_ID">
<Columns>
<asp:BoundField DataField="IMG_ID" HeaderText="IMG_ID" InsertVisible="False" ReadOnly="True" SortExpression="IMG_ID" />
<asp:BoundField DataField="IMG_NAME" HeaderText="IMG_NAME" SortExpression="IMG_NAME" />
<asp:TemplateField HeaderText="IMG_IMAGE">
<ItemTemplate>
<asp:Image ID="Image1" runat="server" ImageUrl='<%# "Handler1.ashx?IMG_ID=" + Eval("IMG_ID")%>'/>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>"
ProviderName="<%$ ConnectionStrings:ConnectionString2.ProviderName %>"
SelectCommand="SELECT [IMG_ID],[IMG_NAME],[IMG_IMAGE] FROM [MYIMGTABLE]">
</asp:SqlDataSource>
这是完成我的项目的最后一个难题……救命!