|
|
|
จะใส่เงื่อนไขใน IF ใส่ไม่ถูก อะครับพี่ๆเป็นเงื่อนไขเกี่ยวกับคำนวนยอดขายสามเดือนนะครับ |
|
|
|
|
|
|
|
Code (C#)
private void get3month()
{
string strd, strd1, strd2, strd3, strm, stry, strdt;
strd1 = "/31/";
strd2 = "/30/";
strd3 = "/29/";
strd = cb_date.EditValue.ToString().Substring(3, 2);
strm = cb_date.EditValue.ToString().Substring(0, 2);
stry = cb_date.EditValue.ToString().Substring(6, 4);
if (ตรงนี้ผมไม่รู้จะใส่อะไรดี....ใส่แล้วก็ ERROR)
{
// ตรงนี้ด้วยครับ
}
strdt = strm + strd + stry;
txtdate.EditValue = strdt;
Tag : ASP, Ms SQL Server 2008, C#
|
|
|
|
|
|
Date :
2012-02-14 10:51:53 |
By :
time.toon |
View :
1465 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
จะเช็คอะไรก็ใส่ไปสิครับ
|
|
|
|
|
Date :
2012-02-14 11:06:49 |
By :
Dragons_first |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ผมต้องการ ดู ยอดขาย 3 เดือนนะครับแต่ ตั้งเงื่อไขไม่ได้อะครับ ไม่รู้จะตั้งเงื่อนไขยังไง....จะดึงออกมาดูใน datagrid ครับ
Code (C#)
private void get3month()
{
string strd, strd1, strd2, strd3, strm, stry, strdt;
strd1 = "/31/";
strd2 = "/30/";
strd3 = "/29/";
strd = cb_date.EditValue.ToString().Substring(3, 2);
strm = cb_date.EditValue.ToString().Substring(0, 2);
stry = cb_date.EditValue.ToString().Substring(6, 4);
if (ตรงนี้ผมไม่รู้จะใส่อะไรดี....ใส่แล้วก็ ERROR)
{
strdt = strm + strd + stry;
txtdate.EditValue = strdt;
}
DT = (Convert.ToInt32(StrMount) - Mount);//month now - month select = month show
if ((DT < 0))//month show < 0
{
DT = 0; //month show = 0
DT = (Mount - Convert.ToInt32(StrMount));//month show = month select - month now
Str3 = cbdate_str.Text.Substring(6, 4);//year now
DT2 = (12 - DT);//12 - montn show = month show2
DT3 = (Convert.ToInt32(Str3) - 1);//year now - 1 = year show
X = DT2.ToString().Length;
if ((X == 1))
{
Dateback = ("0" + DT2.ToString());
Str2 = (Dateback
+ (cbdate_str.Text.Substring(2, 4) + DT3.ToString()));
}
else
{
Str2 = (DT2.ToString()
+ (cbdate_str.Text.Substring(2, 4) + DT3.ToString()));
}
MessageBox.Show(Str2);
dsca = ojsql2.GetDataSet("select month(ddate) dmonth,sum(iquantity) qty,sum(isum )amt from salebillvouch a inner join salebillvouchs b on a.sbvid=b.sbvid where cinvcode='" + txtpd_code.Text + "' and ddate>='" + cbdate_str.EditValue + "' and ddate<='" + Str2 + "' group by month(ddate)", "data");
gvFile.DataSource = dsca.Tables[0];
}
else
{
Str3 = cbdate_str.Text.Substring(6, 4);
DT3 = (Convert.ToInt32(Str3) - 1);
X = DT.ToString().Length;
if ((X == 1))
{
Dateback = ("0" + DT.ToString());
if ((Dateback == "00"))
{
Str2 = ("12"
+ (cbdate_str.Text.Substring(2, 4) + DT3.ToString()));
}
else
{
Str2 = (Dateback
+ (cbdate_str.Text.Substring(2, 3) + cbdate_str.Text.Substring(5, 5)));
}
}
else if ((DT.ToString() == "00"))
{
Str2 = ("12"
+ (cbdate_str.Text.Substring(2, 4) + DT3.ToString()));
}
else
{
Str2 = (DT.ToString()
+ (cbdate_str.Text.Substring(2, 3) + cbdate_str.Text.Substring(5, 5)));
}
MessageBox.Show(Str2);
dsca = ojsql2.GetDataSet("select month(ddate) dmonth,sum(iquantity) qty,sum(isum )amt from salebillvouch a inner join salebillvouchs b on a.sbvid=b.sbvid where cinvcode='" + txtpd_code.Text + "' and ddate>='" + Str2 + "' and ddate<='" + cbdate_str.EditValue + "' group by month(ddate)", "data");
gvFile.DataSource = dsca.Tables[0];
}
}
|
ประวัติการแก้ไข 2012-02-14 11:56:09
|
|
|
|
Date :
2012-02-14 11:54:00 |
By :
time.toon |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|