使用Select Query [SQL查询问题]插入Where想法? [英] Insert into Where idea with Select Query [SQL Query Problem]?
本文介绍了使用Select Query [SQL查询问题]插入Where想法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
字符串 QueryStr = INSERT INTO MapDataImage VALUES(@Image)SELECT @Source FROM MapDataImage其中columnName =' + TextBox1.Text + ';;
i想要将值插入特定位置
但我听说我不能使用插入查询的地方....
所以我可以使用SELECT查询在哪里.. ..
例如=情景是
让我说出我的名字是促销
所以我想添加图片,其中name = promod
所以我想要使用sql列名检查文本框值...
解决方案
// 尝试这个:
String QueryStr = INSERT INTO MapDataImage(ImageFieldName)SELECT SourceFieldName FROM MapDataImageTableName Where SearchFieldName =' + TextBox1 .Text + ';
试试这个... :)
String QueryStr = INSERT INTO MapDataImage(ImageFieldName)VALUES(SELECT SourceFieldName FROM MapDataImageTableName Where SearchFieldName =' + TextBox1.Text + ');
String QueryStr = "INSERT INTO MapDataImage VALUES (@Image) SELECT @Source FROM MapDataImage Where columnName ='" + TextBox1.Text + "';";
i want to Insert values to particular location
but i heard that i cant use where with insert query....
so can i use SELECT query for where....
eg = scenario is
let say my name is promod
so i want to add image where name = promod
so for that i want to check textbox value with sql column name...
解决方案
// TRY THIS: String QueryStr = "INSERT INTO MapDataImage(ImageFieldName) SELECT SourceFieldName FROM MapDataImageTableName Where SearchFieldName = '" + TextBox1.Text + "'";
Try this...:)
String QueryStr = "INSERT INTO MapDataImage(ImageFieldName) VALUES ( SELECT SourceFieldName FROM MapDataImageTableName Where SearchFieldName = '" + TextBox1.Text + "'");
这篇关于使用Select Query [SQL查询问题]插入Where想法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文