Hello,
Is this enough?
This is the error line:
rowsAffected = command.ExecuteNonQuery()
Charles
Public Function SaveCategories(ByVal CatID As Integer, ByVal CatName As
String, ByVal CatDesc As String, ByVal CatStatus As String, ByVal
rowsAffected As Integer) As Integer
Dim parameters As OleDb.OleDbParameter() = { _
New OleDb.OleDbParameter("@CatID", OleDb.OleDbType.Integer), _
New OleDb.OleDbParameter("@CatName", OleDb.OleDbType.VarChar, 50), _
New OleDb.OleDbParameter("@CatDesc", OleDb.OleDbType.VarChar, 50), _
New OleDb.OleDbParameter("@CatStatus", OleDb.OleDbType.Char, 1)}
parameters(0).Value = CatID
parameters(1).Value = CatName
parameters(2).Value = CatDesc
'parameters(3).Value = CatStatus
If CatStatus Then
parameters(3).Value = "A"
Else
parameters(3).Value = "I"
End If
Dim NewCatID As Integer
NewCatID = RunProcedure("Invt_Categories_Save", parameters,
rowsAffected)
Return NewCatID
End Function
Protected Overloads Function RunProcedure( _
ByVal storedProcName As String, _
ByVal parameters As IDataParameter(), _
ByRef rowsAffected As Integer) _
As Integer
Dim result As Integer
MyConnection.Open()
'' Dim command As SqlCommand = BuildIntCommand(storedProcName,
parameters)
Dim command As OleDb.OleDbCommand =
BuildIntCommand(storedProcName, parameters)
rowsAffected = command.ExecuteNonQuery()
result = CInt(command.Parameters("ReturnValue").Value)
MyConnection.Close()
Return result
End Function
Private Function BuildIntCommand( _
ByVal storedProcName As String, _
ByVal parameters As IDataParameter()) _
As OleDb.OleDbCommand
'' As SqlCommand
'' Dim command As SqlCommand = _
Dim command As OleDb.OleDbCommand = _
BuildQueryCommand(storedProcName, parameters)
'' Dim parameter As New SqlParameter
Dim parameter As New OleDb.OleDbParameter
With parameter
.ParameterName = "ReturnValue"
.DbType = OleDb.OleDbType.Integer ' SqlDbType.Int
.Size = 4
.Direction = ParameterDirection.ReturnValue
.IsNullable = False
.Precision = 0
.Scale = 0
.SourceColumn = String.Empty
.SourceVersion = DataRowVersion.Default
.Value = Nothing
End With
command.Parameters.Add(parameter)
Return command
End Function