改變格式我有一個日期變量,看起來像這樣:VB.NET SQL日期查詢
Dim LogDate As Date = Date.Today.AddDays(-1)
格式出來,如:#4/5 /網友排名
然後它作爲WHERE子句進入SQL選擇查詢。當我調試時,查詢已將此更改爲'05/04/2010'。我希望它的格式爲'04/05/2010',就像聲明時一樣。有關我如何做到這一點的任何想法?
熙是查詢:
Dim sqlCmd As New SqlCommand("SELECT TOP (100) PERCENT tblBackup.BackupName,
tblBackupArchive.BackupDate, tblStatus.Status FROM tblStatus INNER JOIN tblBackupArchive ON
tblStatus.StatusID = tblBackupArchive.StatusID INNER JOIN tblBackup ON tblBackupArchive.BackupID =
tblBackup.BackupID INNER JOIN tblClient ON tblBackup.ClientID = tblClient.ClientID WHERE tblBackupArchive.BackupDate = '" & LogDate & "' AND (tblBackupArchive.StatusID = 3) ORDER BY
tblBackupArchive.BackupDate DESC", connection)
- Jonesy
您的開發系統運行的文化是什麼? – 2010-04-06 14:41:01
你如何把它放入查詢? – 2010-04-06 14:41:17
我已添加我的查詢 – iamjonesy 2010-04-06 14:46:31