- Create a structure Fraction (numerator, denominator). Accept details of n fraction and write a menu driven program to perform the following operations. Write separate functions for different options. Use dynamic memory allocation.
i) Display the largest Fraction.
ii) Display the smallest Fraction.
iii) Sort Fraction.
iv) Display all.
Note: While accepting fractions, store the fractions in the reduced form.
E
EliteBrain
@EliteBrain
Posts
-
Structure Fraction With Switch -
InvalidOperationExpression was unhandled by user code(Enterprise Library)Public Function GetMaxSerialNumber(ByVal docType) As Int32
Dim db As Database = DatabaseFactory.CreateDatabase("igrwebConnectionString") Dim sqlCommand As String = SP\_UPDATE\_DOCUMENTDETAILS Dim dbCommand As DbCommand = db.GetStoredProcCommand(sqlCommand) db.AddInParameter(dbCommand, "@operationType", DbType.String, "R") db.AddInParameter(dbCommand, "@cType", DbType.Int64, docType) Dim SrNo As Integer = db.ExecuteScalar(dbCommand) Return SrNo + 1 End Function
The above code is giving an exception at db.ExecuteScalar(dbCommand) Error is
ExecuteScalar requires the command to have a transaction when the connection assigned to the command is in a pending local transaction. The Transaction property of the command has not been initialized.
Please Help as i am new to enterprise library