현재 모든 결과는 '0'입니다.VB.net에서 두 날짜 간의 주 차이를 어떻게 계산합니까?
내가 뭘 잘못하고 있니?
도움이되면 현재 코드는 SQL 명령 쿼리에서 데이터 테이블을 만든 다음 각 행을 개별적으로보고 각 날짜의 차이를 가져옵니다.
현재 코드 : 나는 당신이 날짜로 날짜를 캐스팅 할 필요가 있다고 생각
Dim Con = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;DataSource=ApplicationData.accdb;Persist Security Info=False;") Con.Open() 'Open the connection Dim strCommand As String = "SELECT fDateAdded, fName FROM Films" Dim SQL As New OleDb.OleDbCommand(strCommand, Con) Dim DataAdapter As New OleDb.OleDbDataAdapter(SQL) Dim DataTable As New DataTable("Films") ' Create a new data table structure DataAdapter.Fill(DataTable) ' Fill the data table structure from the information in the database. For Each row As DataRow In DataTable.Rows MessageBox.Show(DateDiff(DateInterval.Day, row.Item("fDateAdded"), Now)) Next row Con.Close()