|
|
|
สวัสดีครับมีใครรู้ความหมาย Code นี้บ้างผมต้องการแปลงเป็น C# แต่ไม่เข้าใจ Code VB ครับ |
|
|
|
|
|
|
|
Code (VB.NET)
With New SqlDataAdapter(SQLConnections.Cmd)
.SelectCommand.CommandType = CommandType.StoredProcedure
.SelectCommand.CommandText = "main_get_running"
.SelectCommand.Parameters.Add("@TransTable", SqlDbType.NVarChar, 100).Value = "ops_goodreceivedetail"
.SelectCommand.Parameters.Add("@TransPrefix", SqlDbType.NVarChar, 4).Value = ""
.SelectCommand.Transaction = SQLConnections.Tran
.Fill(L_data)
.SelectCommand.Parameters.Clear()
If L_data.Rows.Count > 0 Then
'ต้องการแปลง Code ด้านล่าง
txtGoodsReciveDetailID.Text = CStr(L_data.Rows(0)!TransYear).Substring(2, 2) & CInt(L_data.Rows(0)!TransMonth).ToString("00") & (CInt(L_data.Rows(0)!TransRuning) + 1).ToString("000000000")
End With
Code (C#)
string TransYear, TransMonth, TransRuning;
string GoodsReciveDetailID;
TransYear = L_data.Rows[0]["TransYear"].ToString().Substring(2, 2);
TransMonth = L_data.Rows[0]["TransMonth"].ToString();
TransRuning = L_data.Rows[0]["TransRuning"].ToString();
GoodsReciveDetailID = TransYear & TransMonth.ToString("00") & (TransRuning + 1).ToString("000000000");
//Error = TransMonth.ToString("00"), (TransRuning + 1).ToString("000000000");
Tag : .NET, Ms SQL Server 2012, Web (ASP.NET), VB.NET, C#
|
ประวัติการแก้ไข 2017-06-02 14:57:22 2017-06-02 14:58:04
|
|
|
|
|
Date :
2017-06-02 14:56:27 |
By :
NUTKA |
View :
831 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ได้แล้วครับ
Code (C#)
GoodsReciveDetailID = L_data.Rows[0]["TransYear"].ToString().Substring(2, 2) + Convert.ToInt32(L_data.Rows[0]["TransMonth"]).ToString("00") + (Convert.ToInt32(L_data.Rows[0]["TransRuning"]) + 1).ToString("000000000");
|
|
|
|
|
Date :
2017-06-02 15:01:33 |
By :
NUTKA |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date :
2017-06-05 11:06:48 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|