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 |
|
balajiie
Starting Member
7 Posts |
Posted - 2010-01-28 : 08:33:27
|
| Hi All,I am Beginner in Sql..here is ma code SqlConnection sqlc = new SqlConnection(sConnectionString); SqlCommand sqlcomm; SqlDataAdapter sqlData; try { sqlc.Open(); string strSelectNotBySearch = "select * from OP_Notification where Subject like @Subject and Deleted=0"; sqlcomm = new SqlCommand(strSelectNotBySearch, sqlc); sqlcomm.Parameters.Add("@Subject", SqlDbType.NVarChar, 128).Value = strSub; sqlData = new SqlDataAdapter(sqlcomm); DataTable dt = new DataTable(); sqlData.Fill(dt); return dt; } catch { throw; } finally { if (sqlc.State == ConnectionState.Open) sqlc.Close(); }I need To Get value Like Parameters @Subjectdo ReplyAll is wellBalaji |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2010-01-28 : 08:57:49
|
| try thiswhere Subject like "'%" + @Subject +"%' and Deleted=0JimEveryday I learn something that somebody else already knew |
 |
|
|
balajiie
Starting Member
7 Posts |
Posted - 2010-01-29 : 04:02:13
|
| Hi JimFirst of all Thank for your ReplyBut its not workingShowing some error in the Query itselfI Think There is some problem with the single quotes and double quotesdo ReplyAll is wellBalaji |
 |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2010-01-29 : 07:26:42
|
| What error do you get? Also, could you post strSelectNotBySearch so we can see the exactly what the query looks like?Thanks,JimEveryday I learn something that somebody else already knew |
 |
|
|
balajiie
Starting Member
7 Posts |
Posted - 2010-01-29 : 23:05:57
|
| hi Jim I already Posted Tha Query strSelectNotBySearch aboveAll is wellBalaji |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-01-30 : 00:20:41
|
i dont think there's any problem with query. can you try running the below query in query analyser?select * from OP_Notification where Subject like "'%" + @Subject +"%' and Deleted=0 |
 |
|
|
|
|
|