Hi,
I want to make a database driver for stored procedures.
The Function will look this this:
Function executeStoredProcedureQuery(ByVal storedProcedureName As String, ByVal parameterList As ArrayList) As SqlDataReader
Dim dr As SqlDataReader
Try
sqlConnection.Open() 'open connection
Dim sqlCommand As New SqlCommand
sqlCommand.Connection = sqlConnection
sqlCommand.CommandType = Data.CommandType.StoredProcedure
sqlCommand.CommandText = storedProcedureName
For i = 0 To parameterList.Count - 1
sqlCommand.Parameters.Add("@" + parameterList.Item(i).name, parameterList.Item(i).value)
Next
.....
End Function
My problem is, as you can see, is PASSING THE PARAMETERS.
I wanted to do it as an ArrayList of a custom class called "parameter.vb" which stores the name and value of a given parameter. I am not sure how to do this in VB. Or, there could be a better way to do it. Are there any suggestions?
Mark.
I want to make a database driver for stored procedures.
The Function will look this this:
Function executeStoredProcedureQuery(ByVal storedProcedureName As String, ByVal parameterList As ArrayList) As SqlDataReader
Dim dr As SqlDataReader
Try
sqlConnection.Open() 'open connection
Dim sqlCommand As New SqlCommand
sqlCommand.Connection = sqlConnection
sqlCommand.CommandType = Data.CommandType.StoredProcedure
sqlCommand.CommandText = storedProcedureName
For i = 0 To parameterList.Count - 1
sqlCommand.Parameters.Add("@" + parameterList.Item(i).name, parameterList.Item(i).value)
Next
.....
End Function
My problem is, as you can see, is PASSING THE PARAMETERS.
I wanted to do it as an ArrayList of a custom class called "parameter.vb" which stores the name and value of a given parameter. I am not sure how to do this in VB. Or, there could be a better way to do it. Are there any suggestions?
Mark.
Last edited: