[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Display and Insert SQL queryString, ASP.net

Posted on 2005-05-05
Medium Priority
Last Modified: 2008-01-09
Hello Experts,

I have two statements and wish to only have one as when ran with two they counter act each other and the info is added to the table but not displayed:

Displays the info i want:  

queryString = "select * from tCart where OrderNbr = " + OrderNbHS;

Copies the info i want:    

queryString = "INSERT INTO [tOrderDetail] SELECT [pcode],[qty],[OrderNbr] FROM [tCart] WHERE OrderNbr = " + OrderNbHS;

Thank You!
Question by:henrym01

Accepted Solution

rajaloysious earned 1000 total points
ID: 13934496
Are you looking for one SQL statement which will insert and select at one go:
This isnt possible with a SQL statemtent, but can be obviously done by a stored procedure:

Call the stored procedure from c# using Command.Execute to give a datareader which will have the details to display

stored procedure will have two statement one for inser and the other for select - see below link for more details


Expert Comment

ID: 13936639
i am not getting ur question...

In the above case ...u cannot have two statements combine...

but u can use the insert statement first and then select so u can get the inserted data displayed.


Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question