الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

سؤال ف ى الحفظ

بدأه shosho842000 في 23 مايو 2009 · 0 رد · 437 مشاهدة · في ADO.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1

السلام عليكــم ورحمـة الله وبركاتــه ،،

ايه الغلط فى الكود دا انا هنا بعمل انى بستعرض الدرجة بتاعت الموظف بحيث انه لو مدير عام هيضرب النسبة بتاعة الحافز فى 141 ولو غير كدا هيضربها فى 110 لو بنسبة الحافز بتاعته 100

وبعدين هيحسب الضربية والتامين الكود مش بيطلع error بس مش بيحفظ

وشكرا

الكود

If cn.State = ConnectionState.Open Then cn.Close()

cn.Open()

cmd.CommandText = "select name from sal1 where id=@id1 and date=@date"

cmd.Parameters.Add("@id1", SqlDbType.VarChar).Value = TextBox1.Text

cmd.Parameters.Add("date", SqlDbType.DateTime).Value = TextBox3.Text

dr = cmd.ExecuteReader

If (dr.Read) Then

If (dr("name") = "مدير عام") Then

If cn.State = ConnectionState.Open Then cn.Close()

cn.Close()

cmd.CommandText = "select subbounss.bouns1,salary.total_sal from subbounss,salary where subbounss.id=salary.id and subbounss.id=@id10 "

cmd.Parameters.Add("id10", SqlDbType.VarChar).Value = TextBox1.Text

dr = cmd.ExecuteReader

If (dr.Read) Then

If (dr("subbounss.bouns1") = 100) Then

price = (141 * (dr("total_sal")) / 100)

Else

price = (110 * (dr("total_sal")) / 100)

End If

If (dr("subbounss.bouns1") < 100) Then

price = (((dr("bouns1") * 141) / 100) * dr("total_sal")) / 100

Else

price = (((dr("bouns1") * 110) / 100) * dr("total_sal")) / 100

End If

End If

End If

End If

'حساب قيمة الموظبة

If cn.State = ConnectionState.Open Then cn.Close()

cn.Open()

cmd.CommandText = "select days from subbounss where id=@id12 "

cmd.Parameters.Add("@id12", SqlDbType.VarChar).Value = TextBox1.Text

'cmd.Parameters.Add("@date", SqlDbType.VarChar).Value = TextBox3.Text

dr = cmd.ExecuteReader

If (dr.Read) = True Then

price1 = dr("days") * 0.75

total = price + price1

End If

'حساب الضريبة

If cn.State = ConnectionState.Open Then cn.Close()

cn.Open()

cmd.CommandText = "select name from sal1 where id=@id9 and date=@date4"

cmd.Parameters.Add("@id8", SqlDbType.VarChar).Value = TextBox1.Text

cmd.Parameters.Add("date4", SqlDbType.DateTime).Value = TextBox3.Text

dr = cmd.ExecuteReader

If (dr("name") = "مدير عام") Then

tax = (total * 10) / 100

Else

tax = (total * 5) / 100

End If

'حساب التامين

disc = (total * 10) / 100

If cn.State = ConnectionState.Open Then cn.Close()

cn.Open()

cmd.CommandText = "insert into bounss values(@id,@name,@tax,@disc,@month,@price,@price1,@total)"

cmd.Parameters.Add("@id", SqlDbType.VarChar).Value = TextBox1.Text

cmd.Parameters.Add("@name", SqlDbType.VarChar).Value = TextBox2.Text

cmd.Parameters.Add("@tax", SqlDbType.Float).Value = tax

cmd.Parameters.Add("@disc", SqlDbType.Float).Value = disc

cmd.Parameters.Add("@month", SqlDbType.DateTime).Value = TextBox3.Text

'cmd.Parameters.Add("@total_sal", SqlDbType.Float).Value = total_sal

cmd.Parameters.Add("@price", SqlDbType.Float).Value = price

cmd.Parameters.Add("@price1", SqlDbType.Float).Value = price1

cmd.Parameters.Add("@total", SqlDbType.Float).Value = total

cmd.ExecuteNonQuery()

If cn.State = ConnectionState.Open Then cn.Close()

cn.Open()

cmd.CommandText = "select subbounss.id,subbounss.name,subbounss.bouns1,subbounss.days,bounss.tax,bounss.di

sc,bounss.price,bounss.price1,bounss.total from subbounss,bounss,salary where subbounss.id=bounss.id and bounss.id=@id9"

cmd.Parameters.Add("@id9", SqlDbType.VarChar).Value = TextBox1.Text

tb.Load(cmd.ExecuteReader)

DataGridView1.DataSource = tb

لو فى اى تعديل ياريت اعرف

وشكرا

مواضيع مشابهة