 |
|
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 :
861 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |