Visual Basicの日付をSQL 121形式(yyyy-mm-dd hh:mi:ss.mmm)にするにはどうすればよいですか。VBとSQLの日時
このフォーマットは、オブジェクトのFormatDateTimeリストにはないことに気づきました。
この形式をReporting Servicesに使用します。
Visual Basicの日付をSQL 121形式(yyyy-mm-dd hh:mi:ss.mmm)にするにはどうすればよいですか。VBとSQLの日時
このフォーマットは、オブジェクトのFormatDateTimeリストにはないことに気づきました。
この形式をReporting Servicesに使用します。
date.ToString("yyyy-MM-dd HH:mm:ss.fff")
これが私を助けたので、私は少しを追加するだろうと思いました。 その後、文字列としてメソッドに渡された場合:
Shared SomeFunction(ByRef sStartDate as String)
Dim StartTime As DateTime = DateTime.Parse(sStartDate)
command.Connection = connection
command.CommandType = CommandType.StoredProcedure
command.CommandText = "SomeStoredProcedure"
command.Parameters.Add("@StartDateTime", SqlDbType.DateTime)
command.Parameters("@StartDateTime").Value = StartTime.ToString("yyyy-MM-dd HH:mm:ss.fff")
乾杯!