Hi all this is my code for a start.
I have looked all over and found quite a few examples of getting the Identity after I have done this insert, does anyone know of a way of implementing this into my existing code?Sub sqlinsert()
Try
kermitconnection = New SqlConnection("Server=localhost;uid=USERNAME;pwd=PASSWORD;database=DATABASE")
kermitconnection.Open()
Dim cmdinsertsupportitem As SqlCommand
cmdinsertsupportitem = New SqlCommand("Insert employees (lastname,firstname,department) Values (@thelastname,@thefirstname,@thedepartment)", kermitconnection)
cmdinsertsupportitem.Parameters.Add("@thelastname", alastname.text)
cmdinsertsupportitem.Parameters.Add("@thefirstname", afirstname.text)
cmdinsertsupportitem.Parameters.Add("@thedepartment", adepartment.text)
cmdinsertsupportitem.ExecuteNonQuery()
kermitconnection.Close()
Catch
End Try
End Sub