Hi Motil
How will I use it in the following:
Public Shared Sub Add_Camp(ByVal Number As Integer, ByVal Description As String)
Dim myCon As New SqlClient.SqlConnection(strCon)
Dim strSelect As String = "Insert into Camp(CampNr, Description) Values(@field1, @field2)"
Dim myCommand As New SqlClient.SqlCommand(strSelect, myCon)
With myCommand.Parameters
.Add("@field1", SqlDbType.Int).Value = Number
.Add("@field2", SqlDbType.VarChar).Value = Description
End With
myCon.Open()
myCommand.ExecuteNonQuery()
Dim iInt As Integer
myCommand.CommandText = "SELECT SCOPE_IDENTITY() statement"
iInt = myCommand.ExecuteScalar
MsgBox(iInt)
myCon.Close()
myCon.Dispose()
End Sub




Reply With Quote