Have the following code to extract the ID of a member once a new member has
been inserted into the SQL 2005 Express database.
Dim myID As String = ""
Dim myConnString As String =
ConfigurationManager.ConnectionStrings("Connection String").ToString
Dim mySelectQuery As String = "SELECT IDENT_CURRENT('Members')"
Dim myConnection As New Data.SqlClient.SqlConnection(myConnString)
Dim myCommand As New Data.SqlClient.SqlCommand(mySelectQuery, myConnection)
Dim myReader As Data.SqlClient.SqlDataReader
myConnection.Open()
myReader = myCommand.ExecuteReader()
myID = myReader.GetInt32(0).ToString
myReader.Close()
myConnection.Close()
Cannot get the required value as keep getting the following error message:-
In order to evaluate an indexed property, the property must be qualified and
the arguments must be explicitly supplied by the user
Thanks
Kevin