开发者

c# class code error

开发者 https://www.devze.com 2023-02-28 10:43 出处:网络
Book_Return_form Book_tag_id=textbox1 Member_id=textbox2 Book_return_on=textbox3 Book_due_date=textbox4 Fine=textbox5
Book_Return_form

Book_tag_id=textbox1
Member_id=textbox2
Book_return_on=textbox3
Book_due_date=textbox4
Fine=textbox5

In this form when I put book-tag_id the rest items come automatically a/c to database and I hv done all till textbox4(book_due_date). Now problem is with fine(textbox5) Fine is calculated acc to membership_type,there are three types of membership silver,gold,platinum Fines are:silver=30,gold=20,platinum=30 so the calculated fine a/c membership come on text box As (return_date-due_date)-30,20or10 ,till now I m working with dataadapter but now I want to work with dll class,I make a dll class and know how to add reference to project but I m missing smthing in my code while I m making class.(so help me in code) I made a stored procedure with name(member_de开发者_Python百科tails)colums:tag_id,member_id,membership_type_id,membership_type(eg:909,5,1,silver)

My full code for dll class is: Firstly,I make class name transcation_details

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;


namespace selectfinedetails
{
public class TransactionService
{

SqlConnection cs;


private void OpenConnection()
{

cs = new SqlConnection();
cs.ConnectionString = "Data Source=IRIS-CSG-174;Initial Catalog=library_system;Integrated Security=True";

cs.Open();

}
public membership_details calculatefine()
{
OpenConnection();
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "Exec member_fine_detail";
SqlParameter prm1=new SqlParameter("member_id", SqlDbType.Int);
cmd.Parameters.Add(prm1);

SqlParameter prm2=new SqlParameter("fine_per_day", SqlDbType.Int);
cmd.Parameters.Add(prm2);
prm1.Direction=ParameterDirection.Output;
prm2.Direction=ParameterDirection.ReturnValue;

membership_details myObjec = new membership_details();
cmd.ExecuteNonQuery();
SqlDataReader sdr = cmd.ExecuteReader();
myObjec.fine_per_day = //cmd.CommandText;(this is error)

return myObjec;

but I this above code I m missing smthing,as this code will result nthing as to calculate fine with member_id…so what code I will add in it and in as calculatefine()

0

精彩评论

暂无评论...
验证码 换一张
取 消