Get index of added record

Results 1 to 2 of 2

Thread: Get index of added record

  1. #1
    Join Date
    Dec 1969

    Default Get index of added record

    Hi <BR><BR>I add a record to a sql database but I need to get the index for adding to another table how would I get the new index, code below so far: <BR><BR>Dim myConn As SqlConnection <BR> Dim Cmd As SqlCommand = Nothing <BR> Dim sql As String = Nothing <BR><BR> myConn = New SqlConnection("Initial Catalog=costingSystem;Data Source=Development;Initial Catalog=costingSystem;Integrated Security=SSPI;Uid=sa;Pwd=7575;") <BR> myConn.Open() <BR><BR>sql = "INSERT INTO Orders(customerID,dateOrdered) VALUES (" + cbCustomerID.Text + ",&#039;" & DateTime.Today & "&#039;)" <BR> Cmd = New SqlCommand(sql, myConn) <BR> Cmd.ExecuteNonQuery() <BR> <BR> myConn.Close() <BR><BR>Thanks <BR><BR>Gary

  2. #2
    Join Date
    Dec 1969

    Default RE: Get index of added record

    There&#039;s a FAQ on this. Ok, it&#039;s for "classic" ASP not .NET. But the query you execute&#039;s going to be the same, I&#039;m sure.<BR><BR>Craig.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts