【问题标题】:How to insert an existing image into a table from another table如何将现有图像从另一个表插入到一个表中
【发布时间】:2018-10-02 13:07:35
【问题描述】:

我有一个包含图像字段的表,我需要将该图像字段插入到另一个表中,如下所示:

SqlDataAdapter da = new SqlDataAdapter(select id,stdpic from student)
dt.Clear(); da.Fill(dt);
insert into team(teamid,teampic)values('"+dt.Rows[0][0].tostring()+"','"+dt.Rows[0][1].tostring()+"')

怎么做?

【问题讨论】:

  • 您好,欢迎来到 SO。完全不清楚您在这里要做什么。但是,图像数据类型已被弃用近 15 年,是时候升级您的架构了。此外,您迫切需要使用参数化查询,因为这对 sql 注入非常开放。

标签: c# sql-server insert-image


【解决方案1】:

您将不得不选择一种新格式,也许是 varbinary

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-10-15
    • 2014-07-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-17
    • 2021-04-25
    相关资源
    最近更新 更多