An SDF file will most likely (in this case) be and SqlCE file, rather than an SQL file. This is a stand alone database that does not use SQL server.
Instead, use the SqlCEConnection and SqlCECommand Classes and you should be fine. You will need to reference the System.Data.SqlServerCe assembly (in system.data.sqlserverce.dll).
See
MSDN[
^] for more details.
[edit]Typos - OriginalGriff[/edit]
"Thanks a lot for your answer. It worked perfectly fine. OK can you please tell me that can the SqlCEConnection can do all things that SqlConnection can? - Shah Rukh Qasim 6 mins ago"
It can do pretty much everything (a good description is
here[
^]). The main difference is that it is single user rather than multiuser and intended for standalone applications.
SQLServer can read these (but it can be a pain to do sometimes in my experience). There is a query tool here:
SQL Server CE Query Tool[
^] which is a little less painful.
It's handy to have, the syntax is the same etc., just you don't need SQL Server installed because the .NET assembly handles it all internally. This can make distribution easier, and be a lot more flexible than using XML data files sometimes!