 |
|
ต้องการให้ countdate1 เก็บค่าเป็นจำนวนวันที่ที่countมาได้ค่ะ
Code (C#)
public int CountDateStamp(string employeecode, string pmperiodid)//นับวันที่ สมมตินับได้15วัน เขียนในclassนะค่ะ
{
connect();
SqlCommand command = new SqlCommand(@"select COUNT(DateStamp) AS CountDateStamp from vTimeInOut where EmployeeCode =@EmployeeCode
and DateStamp >=(SELECT BeginDate From vPMPeriod Where PMPeriod_ID =@PMPeriod_ID
And PMPeriodStatus = 0) and DateStamp<=dbo.fGen8DateFormat(Getdate()) ", con);
command.Parameters.AddWithValue("@EmployeeCode", employeecode);
command.Parameters.AddWithValue("@PMPeriod_ID", pmperiodid);
roweffect = command.ExecuteNonQuery();
return roweffect; // return เป็น-1
}
//ส่วนอันนี้เรียกใช้classในฟอร์ม
Code (C#)
private void btnApprove_Click(object sender, EventArgs e)
{
int countdate;
Double wageratemonth, amount, countdate1,c,total;
countdate = cCashadvancee.CountDateStamp(txtSearchEmpCode.Text, cbPMPeriod_ID.SelectedValue.ToString());
countdate1 = Convert.ToDouble(countdate);
}
//แล้วค่า countdate1มันออกมาเป็น-1อะค่ะ
Tag : .NET, C#
|
ประวัติการแก้ไข 2012-07-05 11:40:35 2012-07-05 11:42:06
|
 |
 |
 |
 |
Date :
2012-07-05 11:29:07 |
By :
rassarin |
View :
1115 |
Reply :
4 |
|
 |
 |
 |
 |
|
|
|
 |