Hi Guys,
Ok I have managed to call the function. I am now getting an error saying I cannot save a null to the database. Obviously this means I am not passing the data correctly. I am missing the point somewhere because:
Overrides Public Function Insert() As Boolean
Dim cmdToExecute As SqlCommand = New SqlCommand()
cmdToExecute.CommandText = "dbo.[pr_ClientandPhone_Insert]"
cmdToExecute.CommandType = CommandType.StoredProcedure
' // Use base class' connection object
cmdToExecute.Connection = _mainConnection
Insert() is not passed any variables.
How do I set the variables required by this bit of code in the insert():
cmdToExecute.Parameters.Add(New SqlParameter("@lCliAutoId", SqlDbType.BigInt, 8, ParameterDirection.Input, False, 19, 0, "", DataRowVersion.Proposed, _cliAutoId))
cmdToExecute.Parameters.Add(New SqlParameter("@sPhoneNum", SqlDbType.Char, 15, ParameterDirection.Input, False, 0, 0, "", DataRowVersion.Proposed, _phoneNum))
cmdToExecute.Parameters.Add(New SqlParameter("@sMobileNum", SqlDbType.Char, 15, ParameterDirection.Input, False, 0, 0, "", DataRowVersion.Proposed, _mobileNum))
cmdToExecute.Parameters.Add(new SqlParameter("@lAutoId", SqlDbType.BigInt, 8, ParameterDirection.Output, False, 19, 0, "", DataRowVersion.Proposed, _autoId))
cmdToExecute.Parameters.Add(new SqlParameter("@iErrorCode", SqlDbType.Int, 4, ParameterDirection.Output, False, 10, 0, "", DataRowVersion.Proposed, _errorCode))
I'm Lost until someone helps me.
Thanks, I appreciate it.
Best Regards,
Steve.
Steve2106 wrote:
Hi Guys,
First post here.
Can some one help me with how I call a function? This is part of the code generated by LLBLGen:
Namespace Test2602
Public Class ClientandPhone
Inherits DBInteractionBase
Region " Class Member Declarations "
Private _phoneNum, _mobileNum, _name, _add1 As SqlString
End Region
Public Sub New()
' // Nothing for now.
End Sub
Overrides Public Function Insert() As Boolean
Dim cmdToExecute As SqlCommand = New SqlCommand()
cmdToExecute.CommandText = "dbo.[pr_ClientandPhone_Insert]"
cmdToExecute.CommandType = CommandType.StoredProcedure
' // Use base class' connection object
cmdToExecute.Connection = _mainConnection
How do I call the Insert() Function above from my code.
I'm using Visual Studio 2005 (VB)
Thanks for your help.
Best Regards,
Steve.