Arrays and lists in SQL Server 2008 using Table-Valued Parameters Arrays and lists in SQL Server 2005 and beyond when TVPs do not cut it.
Here's one take on it, basically pass the "list" in a single string param, seperated by commas (or whatever) and the parse it in the sproc. vyaskn.tripod.com/passing_arrays_to_stor... there's also this Since there is no Sqlserver array parameter, what's the best way to proceed?
If it were me, I would just make sure I was only opening the Connection once: Dim CommandText As String = _ "UPDATE MyTYable SET SomeField = @SomeField " & _ "WHERE UserID = @UserID" Using cn As New SqlClient. SqlConnection(MyConnectionString) Using cmd As New SqlClient. SqlCommand(cn, CommandText) 'The Record key in the database: cmd.Parameters.
AddWithValue("@UserID", -1) 'Whatever it is you plan to UPDATE: cmd.Parameters. Add("@SomeField", "") cn.Open() For Each Item As ListItem In ris cmd. Parameters("@UserID").
Value = Item. Value cmd. Parameters("SomeField").
Value = SomeValueFromSomeWhere cmd.ExecuteNonQuery() Next End Using End Using Obviously, this will need to be tuned a little to your particular useage. I am not certain what you are doing with your assembled list of UserID's, but the code skeleton above represents a relatively efficient means of performing a series of INSERTS or UPDATES without incurring the overhead of opening and closing the overall connection. If the number of updates you need to perform is truly onerous, one of the string concatenation methods mentioned above might be more efficient, and/or the rapid insertion of all the values to be UPDATED into a Temp Table on the backside Db, followed by a SELECT INTO statement which handles the bulk INSERT on the server.
As with Transact-SQL stored procedures, information may be returned from . NET Framework stored procedures using OUTPUT parameters. The Transact-SQL DML syntax used for creating .
NET Framework stored procedures is the same as that used for creating stored procedures written in Transact-SQL. The corresponding parameter in the implementation code in the . NET Framework class should use a pass-by-reference parameter as the argument.
Note that Visual Basic does not support output parameters in the same way that Visual C# does. Once the assembly containing the above CLR stored procedure has been built and created on the server, the following Transact-SQL is used to create the procedure in the database, and specifies sum as an OUTPUT parameter. Note that sum is declared as an int SQL Server data type, and that the value parameter defined in the CLR stored procedure is specified as a SqlInt32 CLR data type.
When a calling program executes the CLR stored procedure, SQL Server automatically converts the SqlInt32 CLR data type to an int SQL Server data type. For more information about which CLR data types can and cannot be converted, see Mapping CLR Parameter Data.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.