What is the use of select statement in insert statement ?

  • Thread starter Thread starter cmhasan
  • Start date Start date
C

cmhasan

When I connect to any table through UI .NET add select statement in
Insert statement by default .e.g.
"INSERT INTO TestMessageText(msg_no, line_no, msg_text, time_stamp)
VALUES (@msg_no, @line_no, @msg_text, @time_stamp); SELECT msg_no,
line_no, msg_text, time_stamp FROM TestMessageText WHERE (line_no =
@line_no) AND (msg_no = @msg_no)"

Can any one explain what is the use of the select statement here and
how to use it ?

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
 
Hasan,

That looks like a batched statement. I.e. executing that through a
dataadapter or whatever will first execute the insert, and then allow you to
fill a dataset with results of the query --- i.e. simple as this --

You've inserted your data, but what if someone else had inserted while you
were working in a disconnected mode? It refreshes your UI, with what is the
latest in the database.


- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
 
Back
Top