D
Dikkuuhh
Hi, i have a function that can execute stored procedures, but i don`t
know how i can give it back to the other classes. I did it in an
ArrayList now, but how can i do it better, i can`t make it variable how
much values i get....
This is my code:
Public Function ExSP(ByVal StoredProcedure As String, ByVal
Parameters As ArrayList, ByVal ParamName As ArrayList) As ArrayList
m_strSQLConnection = New SqlConnection("User ID=oriflame02;" &
_
"Password=Ujn87-yt#;" & _
"Server=kemal.interconnect.nl,1433;" & _
"Database=oriflame02;" & _
"Connection Lifetime=0")
Dim cmdAuthors As New SqlCommand(StoredProcedure,
m_strSQLConnection)
cmdAuthors.CommandType = CommandType.StoredProcedure
Dim i As Integer
If Parameters.Count = ParamName.Count Then
For i = 0 To Parameters.Count - 1
cmdAuthors.Parameters.AddWithValue(ParamName.Item(i),
Parameters.Item(i))
Next i
Else
End If
Dim drAuthors As SqlDataReader
m_strSQLConnection.Open()
drAuthors = cmdAuthors.ExecuteReader()
i = 0
Do While drAuthors.Read()
ArList.Add(drAuthors.GetValue(0) & "<br/>")
ArList.Add(drAuthors.GetValue(1) & "<br/>")
ArList.Add(drAuthors.GetValue(2) & "<br/>")
ArList.Add(drAuthors.GetValue(3) & "<br/>")
ArList.Add(drAuthors.GetValue(4) & "<br/>")
ArList.Add(drAuthors.GetValue(5) & "<br>")
Loop
drAuthors.Close()
m_strSQLConnection.Close()
Return ArList
End Function
Can somebody help me, please??
Thnx
Koen
know how i can give it back to the other classes. I did it in an
ArrayList now, but how can i do it better, i can`t make it variable how
much values i get....
This is my code:
Public Function ExSP(ByVal StoredProcedure As String, ByVal
Parameters As ArrayList, ByVal ParamName As ArrayList) As ArrayList
m_strSQLConnection = New SqlConnection("User ID=oriflame02;" &
_
"Password=Ujn87-yt#;" & _
"Server=kemal.interconnect.nl,1433;" & _
"Database=oriflame02;" & _
"Connection Lifetime=0")
Dim cmdAuthors As New SqlCommand(StoredProcedure,
m_strSQLConnection)
cmdAuthors.CommandType = CommandType.StoredProcedure
Dim i As Integer
If Parameters.Count = ParamName.Count Then
For i = 0 To Parameters.Count - 1
cmdAuthors.Parameters.AddWithValue(ParamName.Item(i),
Parameters.Item(i))
Next i
Else
End If
Dim drAuthors As SqlDataReader
m_strSQLConnection.Open()
drAuthors = cmdAuthors.ExecuteReader()
i = 0
Do While drAuthors.Read()
ArList.Add(drAuthors.GetValue(0) & "<br/>")
ArList.Add(drAuthors.GetValue(1) & "<br/>")
ArList.Add(drAuthors.GetValue(2) & "<br/>")
ArList.Add(drAuthors.GetValue(3) & "<br/>")
ArList.Add(drAuthors.GetValue(4) & "<br/>")
ArList.Add(drAuthors.GetValue(5) & "<br>")
Loop
drAuthors.Close()
m_strSQLConnection.Close()
Return ArList
End Function
Can somebody help me, please??
Thnx
Koen