What is the code with the smallest number of lines that will generate a DataTable from this SQL query?
SELECT *
FROM [Table1]
WHERE ([Date] BETWEEN @Date1 AND @Date2) AND
([Field1] IS NULL OR [Field2] IS NULL)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use SqlDataAdapter to fill a DataTable.
Use using block with your
SqlConnection,SqlCommandandSqlDataAdaptersince they implementIDisposableinterface. Also use Parameterized query