我在mysql中创建了一个存储过程
CREATE DEFINER=`sqladmin`@`%` PROCEDURE `sp_GetContainerPath`(IN P_ContainerId INT,
OUT P_ContainerPath VARCHAR (255))
Begin
SELECT sf_GetContainerPath(P_ContainerId)
INTO P_ContainerPath; END
此过程提供了来自containerPath的所有路径。现在我在vb.net中创建应用程序,当我按下按钮,然后我可以通过此过程获取所有containerPath。
Friend Function getContainerpath(ByVal containerId As Integer) As DataSet
Try
Dim dbh As New DatabaseHandler
Dim ds As DataSet
Dim inParams As New Hashtable
Dim outParams As New Hashtable
inParams.Add("P_ContainerId", containerId)
outParams.add("P_ContainerPath", Nothing)
ds = dbh.callPro2("sp_GetContainerPath", inParams, outParams)
Return ds
Catch ex As Exception
logException("getContainerpath", ex.Message)
Throw
End Try
End Function
Private Sub GetContainerButton_Click(ByVal containerid, sender As System.Object, e As System.EventArgs) Handles GetContainerButton.Click end sub
Friend Sub callProc2(ByVal procName As String, ByVal inParams As Hashtable, ByRef outParams As Hashtable, _
Optional ByRef inoutParams As Hashtable = Nothing)
logQuery("callProc2", procName, inParams, inoutParams)
Dim elapsedTicks As Long
Dim elapsedSpan As New TimeSpan(elapsedTicks)
elapsedTicks = Date.Now.Ticks
Try
If Not inParams.Contains("P_UserId") Then
inParams.Add("P_UserId", ConfigurationHandler.UserId)
End If
If Not inParams.Contains("P_MachineId") Then
inParams.Add("P_MachineId", ConfigurationHandler.machineId)
End If
If Not inParams.Contains("P_ApplicationId") Then
inParams.Add("P_ApplicationId", ConfigurationHandler.applicationId)
End If
'Do the actual query
'
Select Case UCase(_dbType)
Case "MYSQL"
callSQLProc(procName, inParams, outParams, inoutParams)
Case "XML"
_xmlDatabase.callXMLProc(procName, inParams, outParams, inoutParams)
Case Else
Throw New Exception("INVALID_DATABASE_TYPE")
End Select
Catch ex As Exception 'generic .net error
logException("callProc2", ex.Message)
Throw
Finally
logResult("callProc2", procName, outParams, inoutParams)
elapsedSpan = New TimeSpan(Date.Now.Ticks - elapsedTicks)
logVerbose("DatabaseHandler:callProc2[" & procName & "]-Elapsed: " & elapsedSpan.ToString)
End Try
End Sub
这是我编写的一段vb代码,用于从存储过程中获取路径。但它没有运行。有人帮忙吗?欢呼声