Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
rpaczkow
Starting Member
1 Post |
Posted - 2008-12-19 : 17:04:26
|
| I have simple code which should return one record but it doesnt. I have only one row where DeliverDate is null What is wrong?SqlConnection conn = new SqlConnection(connstring);conn.Open();SqlTransaction trans = conn.BeginTransaction();SqlCommand comm = new SqlCommand("select * from Messages where DeliverDate=@DeliverDate", conn, trans);SqlParameter para = new SqlParameter();para.SqlDbType = SqlDbType.DateTime;para.SqlValue = DBNull.Value;para.ParameterName = "@DeliverDate";comm.Parameters.Add(para);SqlDataReader reader = comm.ExecuteReader(); |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2008-12-20 : 08:23:00
|
select * from Messages where DeliverDate=NULL wouldn't workIn case of NULL the select statement must be:select * from Messages where DeliverDate IS NULLWebfred No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|
|