It's not possible for mysql side.
But, Try PassDault value from front end
Vb.net Module like
Procedure Samples:
All Procedure Parameter Collection
But, Try PassDault value from front end
Vb.net Module like
Imports MySql.Data.MySqlClient
Module MysqlRemainingParametersCollection
'Add Remaining Parameter
Public Function MysqlRemainingParameters(ByVal Cmd As MySqlCommand, ByVal ProcedureName As String)
Dim dtProcedureParametersMas As New DataTable
Try
Try
If IsNothing(TotalProcedureParametersMainList) = False Then
dtProcedureParametersMas = DTFromRows(TotalProcedureParametersMainList, "SPECIFIC_NAME ='" & ProcedureName & "'")
Else
dtProcedureParametersMas = GetDataTable(CommandType.Text, "call SingleProcedureParameterCollect('" & SDBname & "','" & ProcedureName & "')")
End If
Catch ex As Exception
End Try
If dtProcedureParametersMas.Rows.Count > 0 Then
If dtProcedureParametersMas.Rows(0)("ROUTINE_TYPE") = "FUNCTION" Then
Return Cmd
Exit Function
End If
End If
Dim fparameter As Boolean = False
For i As Integer = 0 To dtProcedureParametersMas.Rows.Count - 1
For j As Integer = 0 To Cmd.Parameters.Count - 1
If dtProcedureParametersMas.Rows(i)("Parameter_Name").ToString.ToUpper = Cmd.Parameters.Item(j).ToString.ToUpper Then
fparameter = True
If fparameter = True Then Exit For
Else
fparameter = False
End If
Next
If fparameter = False Then
If dtProcedureParametersMas.Rows(i)("Data_Type").ToString.ToUpper = "SMALLINT" Or _
dtProcedureParametersMas.Rows(i)("Data_Type").ToString.ToUpper = "TINYINT" Or _
dtProcedureParametersMas.Rows(i)("Data_Type").ToString.ToUpper = "DECIMAL" Or _
dtProcedureParametersMas.Rows(i)("Data_Type").ToString.ToUpper = "INT" Then
If dtProcedureParametersMas.Rows(i)("Parameter_Name").ToString.ToUpper = "$ISCANCELED" Then
Cmd.Parameters.Add(New MySqlParameter(dtProcedureParametersMas.Rows(i)("Parameter_Name").ToString, Nothing))
Else
Cmd.Parameters.Add(New MySqlParameter(dtProcedureParametersMas.Rows(i)("Parameter_Name").ToString, 0))
End If
Else
If dtProcedureParametersMas.Rows(i)("Parameter_Mode") = "INOUT" Then
Cmd.Parameters.Add(New MySqlParameter(dtProcedureParametersMas.Rows(i)("Parameter_Name").ToString, ""))
Else
Cmd.Parameters.Add(New MySqlParameter(dtProcedureParametersMas.Rows(i)("Parameter_Name").ToString, Nothing))
End If
End If
End If
Next
'Add Remaining Prameter End
'Set Direction inputOutput
If dtProcedureParametersMas.Rows.Count > 0 Then
For Each dr As DataRow In dtProcedureParametersMas.Select("Parameter_Mode='INOUT'")
If dtProcedureParametersMas.Select("Parameter_Mode='INOUT'").Length > 0 Then
Cmd.Parameters(dr.Item(0)).Direction = ParameterDirection.InputOutput
End If
Next
End If
If dtProcedureParametersMas.Rows.Count > 0 Then
For Each dr As DataRow In dtProcedureParametersMas.Select("Parameter_Mode='OUT'")
If dtProcedureParametersMas.Select("Parameter_Mode='OUT'").Length > 0 Then
Cmd.Parameters(dr.Item(0)).Direction = ParameterDirection.Output
End If
Next
End If
'Set Direction inputOutput End
Return Cmd
Catch ex As Exception
Return Nothing
XtraMessageBox.Show(ex.Message)
End Try
End Function
End Module
Sample Coding:
sqlCmdOrigal.CommandText = "SP" & sEntryNameWith sqlCmdOrigal.Parameters.Add(New MySqlParameter("$BranchCode", BranchCode)).Add(New MySqlParameter("$VNo", Vno)).Add(New MySqlParameter("$Ref_No", "")).Add(New MySqlParameter("$EntryDate", Format(deEntryDate.DateTime, "yyyy-MM-dd"))).Add(New MySqlParameter("$USerCode", UserCode)).Add(New MySqlParameter("$BankTransaction", 0)).Add(New MySqlParameter("$Mode", 0))'MysqlRemainingParameters(Connectioninfo,ProcedureName).Add(New MySqlParameter("$SeasonHeadCode", dtFloorCashDet.Rows(iRow)("Season")))'Add Remaining ParameterEnd withsqlCmdOrigal = MysqlRemainingParameters(sqlCmdOrigal, sqlCmdOrigal.CommandText)sqlCmdOrigal.ExecuteNonQuery()sqlCmdOrigal.Parameters.Clear()
Initialy Load All Procedure Parameters into TotalProcedureParametersMainList Variable(use login)
Public TotalProcedureParametersMainList As DataTable=nothing
TotalProcedureParametersMainList = GetDataTable(CommandType.Text, "call AllProcedureParameterCollect('" & SDBname & "')")
All Procedure Parameter Collection
CREATE DEFINER=`root`@`%` PROCEDURE `allProcedureParameterCollect`(IN DbName varchar(100))
BEGIN
SET @query = CONCAT('SELECT Parameter_Name,Data_Type,Parameter_Mode,ROUTINE_TYPE,SPECIFIC_NAME FROM information_schema.parameters
WHERE SPECIFIC_SCHEMA=''', DbName, ''';');
PREPARE qry FROM @query;
EXECUTE qry;
DEALLOCATE PREPARE qry;
END
Single Procedure Parameter Collection
CREATE DEFINER=`root`@`%` PROCEDURE `SingleProcedureParameterCollect`(IN DbName varchar(100), IN ProcedureName varchar(100))
BEGIN
SET @query = CONCAT('SELECT Parameter_Name,Data_Type,Parameter_Mode,ROUTINE_TYPE FROM information_schema.parameters
WHERE SPECIFIC_SCHEMA=''', DbName, ''' and SPECIFIC_NAME = ''', ProcedureName, ''';');
PREPARE qry FROM @query;
EXECUTE qry;
DEALLOCATE PREPARE qry;
END
0 Comments