|
|
|
ไวยกรณ์ มันผิดนะครับ ไม่รู้ตรงไหนมันผิด พี่ๆช่วยตรวจให้เด็กน้อยหน่อยนะครับ |
|
|
|
|
|
|
|
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(autoquery)
{
}
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];
}
}
Tag : .NET, Ms SQL Server 2008, Win (Windows App), C#
|
|
|
|
|
|
Date :
2012-02-08 08:55:39 |
By :
time.toon |
View :
1045 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Error Line ไหนครับ ทำไมไม่ใช้การ Build หรือ Debug ดูครับ
|
|
|
|
|
Date :
2012-02-08 09:02:03 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ERROR
Code (C#)
strd = cb_date.EditValue.ToString().Substring(3, 2);
strm = cb_date.EditValue.ToString().Substring(0, 2);
stry = cb_date.EditValue.ToString().Substring(6, 4);
ครับพี่
พี่วิน ครับ ตามไปดู กระทู้นี้ให้ที ครับผมติดแค่นิดเดียวเองครับ
https://www.thaicreate.com/dotnet/forum/073407.html
ขอบคุณล่วงหน้าครับ อิๆๆ
|
ประวัติการแก้ไข 2012-02-08 09:09:31 2012-02-08 09:10:58
|
|
|
|
Date :
2012-02-08 09:09:07 |
By :
time.toon |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|