I want to filter SQL-table between start date and end date, I used before string variable then I use string.format
to make the format mm/dd/yyyy
, I tried now in VB.net 2015 the following code:
Dim S as String
s=inputbox("Enter Start date")
S=string.format(S,"mm/dd/yyyy")
But it doesn't work, can somebody give me a solution?
答案 0 :(得分:0)
您可以尝试使用此处理输入值,假设您只需要将日期值作为格式化字符串,因为您的问题是关于格式化日期:
Dim S As String
S = InputBox("Enter Start date")
If IsDate(S) = True Then
Dim d As Date = Date.Parse(S)
S = d.ToString("mm/dd/yyyy")
Else
'Handle the non date input here
End If
但我认为您应该考虑@Plutonix评论,因为我们并不确切知道您如何发送日期来执行过滤,或者您的表字段是如何定义的。
问候!