N
nashak
Hi,
We are not using Stored Procedures. I need to get back the value of the
primary key (ID) field of the table once I've inserted a new record.
I have a Insert statement as follows:
cmdInsertStudy.CommandText = "Insert into " & TableName & "(" & _
strCol & ") values (@p1, @p2, @p3, @p4,
@p5, @p6, @p7) "
i.e passing 7 parameters.
cmdInsertStudy.CommandType = CommandType.Text
daStudy.InsertCommand = cmdInsertStudy
'Created new parameter to get the value of the ID field that
'is generated by sql server
Dim myParam As SqlParameter =
daStudy.InsertCommand.Parameters.Add("@StudyID", SqlDbType.Int, 10,
"StudyID")
myParam.Direction = ParameterDirection.Output
daStudy.InsertCommand.Transaction = trname
daStudy.Update(dsEmptyStudy, TableName)
What do I do now?
Thanks
We are not using Stored Procedures. I need to get back the value of the
primary key (ID) field of the table once I've inserted a new record.
I have a Insert statement as follows:
cmdInsertStudy.CommandText = "Insert into " & TableName & "(" & _
strCol & ") values (@p1, @p2, @p3, @p4,
@p5, @p6, @p7) "
i.e passing 7 parameters.
cmdInsertStudy.CommandType = CommandType.Text
daStudy.InsertCommand = cmdInsertStudy
'Created new parameter to get the value of the ID field that
'is generated by sql server
Dim myParam As SqlParameter =
daStudy.InsertCommand.Parameters.Add("@StudyID", SqlDbType.Int, 10,
"StudyID")
myParam.Direction = ParameterDirection.Output
daStudy.InsertCommand.Transaction = trname
daStudy.Update(dsEmptyStudy, TableName)
What do I do now?
Thanks