Click here to Skip to main content
15,886,077 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
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...
Posted
Comments
Qadri Jillani 5-Jul-13 2:02am    
promod i think solution 1 will have your work done give it a try :)
promod madushan 5-Jul-13 2:05am    
okay.... thanks

C#
// TRY THIS: 

String QueryStr = "INSERT INTO MapDataImage(ImageFieldName) SELECT SourceFieldName FROM MapDataImageTableName Where SearchFieldName = '" + TextBox1.Text + "'";
 
Share this answer
 
Comments
damodara naidu betha 5-Jul-13 1:13am    
5+
Dineshshp 5-Jul-13 1:43am    
Thanks
Try this...:)


C#
String QueryStr = "INSERT INTO MapDataImage(ImageFieldName) VALUES ( SELECT SourceFieldName FROM MapDataImageTableName Where SearchFieldName = '" + TextBox1.Text + "'");
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900