General information
Title:
Need advise for SQL statement
Environment versions
Network:
Windows 2000 Server
Dear All,
Does my SQL statement for date range, already correct or not?
Dim SQLTemp As New SqlConnection
Dim Cmd As New System.Data.SqlClient.SqlCommand
Dim DataReader As SqlClient.SqlDataReader
Dim mPrintDaily As String = "SELECT * FROM Daily WHERE UDate >= @mDateFrom AND UDate <= @mDateTo ORDER BY UDate"
Dim mFromDate As Date = C1DateEdit2.Text
Dim mToDate As Date = C1DateEdit2.Text
SQLTemp.ConnectionString = SQLConn1.ConnectionString
SQLTemp.Open()
Cmd.Connection = SQLTemp
Cmd.CommandType = CommandType.Text
Cmd.CommandText = mPrintDaily
Cmd.Parameters.Add("@mDateFrom", SqlDbType.DateTime)
Cmd.Parameters("@mDateFrom").Value = mFromDate
Cmd.Parameters.Add("@mDateTo", SqlDbType.DateTime)
Cmd.Parameters("@mDateTo").Value = mToDate
DataReader = Cmd.ExecuteReader
please advise ..
Regards
Winanjaya
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only