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 |
immad
Posting Yak Master
230 Posts |
Posted - 2013-04-29 : 01:09:52
|
HELLO I MAKE A QUERY AND I WANT TO RUN IN C# DATA ADAPTERmy query is like this "select * from inventory where (isnull('" + DropDownList2.Text +"','')='' OR RAM = '" + DropDownList2.Text + "' and (ISNULL ('"+DropDownList1.Text + "','')='' OR PCNAME='" + DropDownList1.Text + "'"))but when i write in C# coding it gives me this error. Incorrect syntax near 'PENTIUM 4'. <----- THIS IS PCNAME and this is real query that i write in sql serverselect * from inventory WHERE(ISNULL(@RAM,'')='' OR RAM = @RAM)AND (ISNULL(@PC,'')='' OR PCNAME = @PC)AND (ISNULL(@IP,'')='' OR IPADDRESS = @IP)AND (ISNULL(@OS,'')='' OR OS = @OS)AND (ISNULL(@CPU,'')='' OR CPU = @CPU)AND (ISNULL(@MB,'')='' OR MB = @MB)AND (ISNULL(@HDD3,'')='' OR HDD3 = @HDD3)please help me i am new in sqlimmad uddin ahmed |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-04-29 : 01:25:12
|
i see two braces in the end. are they part of sql? if yes it should be "select * from inventory where (isnull('" + DropDownList2.Text +"','')='' OR RAM = '" + DropDownList2.Text + "' and (ISNULL ('"+DropDownList1.Text + "','')='' OR PCNAME='" + DropDownList1.Text + "'))" ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
immad
Posting Yak Master
230 Posts |
Posted - 2013-04-29 : 01:57:04
|
THANKS ITS WORKING immad uddin ahmed |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-04-29 : 02:21:18
|
welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-04-29 : 02:21:19
|
welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|