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.ExecuteScalar( _connectionString ,
"set nocount on INSERT INTO tCar (name) VALUES ('Ford') SELECT
CAST(scope_identity() AS
INTEGER) ",
FillSqlParameter());
-- bruce (sqlwork.com)
"FyinsFlip" <go********@fyin.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.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.ExecuteScalar( _connectionString ,
| "INSERT INTO tCar (name) VALUES ('Ford') SELECT CAST(@@Identity AS
| INTEGER) ", FillSqlParameter());
|
| 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/
|