I have several different arrays I am storing information in that was pulled from SQL, now I need to put it all back together into SQL. Only problem is I created a loop to go through and insert each item, but after it's done there are several duplicates... for example:I have 3 rows of data selected for insertion, it will run through, but all three rows will be of the last item... like it runs through fine but doesn't increment...Here's a snippet of the code that does the loop and insertDim theCommand As System.Data.SqlClient.SqlCommand theCommand = New System.Data.SqlClient.SqlCommand theCommand.Connection = theConnection theCommand.CommandText = _ "DECLARE @TSID int " & _ "SELECT @TSID = (SELECT MAX(TSPropertyID)+1 FROM TSProperties) " & _ "INSERT Into TSProperties " & _ "Values (@TSID, 1,'" & GXSelectCodeArray(m) & "','" & GXSelectNameArray(m) & "', '','','" & GXSelectUpdateArray(m) & "','" & Now & "') " & _ "DECLARE @HSID int " & _ "SELECT @HSID = (SELECT MAX(HSPropertyID)+1 FROM HSProperties) " & _ "INSERT into HSProperties " & _ "Values (@HSID,'" & GXSelectNameArray(m) & "','" & GXSelectDescrArray(m) & "', '102','', '1', '0')" & _ "Select name from hsproperties where hspropertyid = @HSID" 'Create an SQL DataAdapter to read the data. Dim theDataAdapter As System.Data.SqlClient.SqlDataAdapter theDataAdapter = New System.Data.SqlClient.SqlDataAdapter theDataAdapter.SelectCommand = theCommand 'Open the command and then read the data. Try Dim r As Integer r = UBound(GXSelectNameArray) If GXSelectNameArray(0) = "" Then MsgBox("Please select at least one access code.", MsgBoxStyle.OkOnly, "Nothing Selected") Else While m <= r theConnection.Open() Dim access As System.Data.DataSet = New System.Data.DataSet access.DataSetName = "Access" theDataAdapter.Fill(access, "Access") theConnection.Close() m = m + 1 End While End If