your syntax is correct, no linebreaks are required to seperate statements, a
space is fine. ExecuteScalar returns the first column of the first row of
the first result set. the way you have the sql coded, you get two result
sets, but thats easily fixed. try:
DataMembers.Car _IDObject = SqlHelper.Execu teScalar( _connectionStri ng ,
"set nocount on INSERT INTO tCar (name) VALUES ('Ford') SELECT
CAST(scope_iden tity() AS
INTEGER) ",
FillSqlParamete r());
-- bruce (sqlwork.com)
"FyinsFlip" <go********@fyi n.com> wrote in message
news:11******** **************@ c13g2000cwb.goo glegroups.com.. .
| Microsoft Data Access Blocks (SqlHelper) you can do an insert and get
| the new row ID without using a stored procedure?
|
| DataMembers.Car _IDObject = SqlHelper.Execu teScalar( _connectionStri ng ,
| "INSERT INTO tCar (name) VALUES ('Ford') SELECT CAST(@@Identity AS
| INTEGER) ", FillSqlParamete r());
|
| Is there a new line symbol I can add before the SELECT, like a ';'
| or something?
|
| --
| Sincerely,
| David Dimmer
|
| Quality Builders of ASP.NET Web Sites
|
| B: 414.769.1233
| M: 414.688.3941
| W:
http://www.milwaukeewebdesigners.com/
|