ถ้ามันไม่เกี่ยวกับ CPU ก็น่าจะเป็น ADODB
ถ้าลองค้นหา Error ตามรูปวิธีแก้ก็น่าจะมีเยอะอยู่ยกตัวอย่างเช่น
find "adodb" in references and see adodb.dll properties.
"Embeded Interop Types" set to false than you can set "Copy Local" to true .
หรือ
--- Could not load type 'ADODB.FieldsToInternalFieldsMarshaler' from assembly ---
Solution is quite simple:
You have to 'manually' modify your .vbproj file and
' change: Code
พอผมไม่เรียกใช้ function นี้ run ได้เฉยเลยครับ ไม่รู้ใช่หรือป่าวแต่ run ได้จริงๆ ?????
(ผมพึ่งหัด .net เลยไป copy มาใช้ จะได้ค่าวันที่บัจจุบันจาก server )
Code (VB.NET)
Public Function Sys_now(Optional ByVal StrFormat$ = "dd/MM/yyyy") As String
Sys_now = ""
Dim RS As New ADODB.Recordset
Dim strMonth$, StrYear$, strHour$, strMinute$, strSecond$, NowYear$
SQL = ("select DATENAME(day, getdate()) , DATENAME(month, getdate()), DATENAME(year, getdate()) , DATENAME(hour, getdate()) , DATENAME(minute, getdate()) , DATENAME(second, getdate()) ")
RS.Open(SQL, Conn, 3, 1)
strDay = RS.Fields(0).Value
strMonth = RS.Fields(1).Value
StrYear = RS.Fields(2).Value
strHour = RS.Fields(3).Value
strMinute = RS.Fields(4).Value
strSecond = RS.Fields(5).Value
RS = Nothing
NowYear = Now.Year
Dim DateT As Date
DateT = strDay + " " + strMonth + " " + NowYear + " " + strHour + ":" + strMinute + ":" + strSecond
Sys_now = Replace(Format(DateT, StrFormat), NowYear, StrYear)
End Function
Caution ADO and ADO MD have not been fully tested in a Microsoft .NET Framework environment. They may cause intermittent issues, especially in service-based applications or in multithreaded applications. The techniques that are discussed in this article should only be used as a temporary measure during migration to ADO.NET. You should only use these techniques after you have conducted complete testing to make sure that there are no compatibility issues. Any issues that are caused by using ADO or ADO MD in this manner are unsupported. For more information, see the following article in the Microsoft Knowledge Base