Unclosed quotation mark before the character string ' '

49 views
Skip to first unread message

nag

unread,
Dec 26, 2009, 2:29:04 AM12/26/09
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
hi friend im getting following error,wen i run
DropDownList1_OnSelectedIndexChanged event

Line 1: Incorrect syntax near 's'.
Unclosed quotation mark before the character string ' '.

here is my query
please help me to solve this

Select a.Category_Id,
a.Category_Name,b.umc,b.Magazine_Name,Magazine_Description From
[magazine_category] a Inner Join magazine b on a.Category_Id =
b.Category_Id and a.Category_Name = 'Men's Interest'

ARUN KUMAR

unread,
Dec 26, 2009, 10:31:18 AM12/26/09
to dotnetde...@googlegroups.com
Small Mistake in your query change like below
 
Select a.Category_Id,
a.Category_Name,b.umc,b.Magazine_Name,Magazine_Description From
[magazine_category] a Inner Join magazine b on a.Category_Id =
b.Category_Id and a.Category_Name = 'Men''s Interest'
 
I have insert sigle quotes near 's'
 
a.Category_Name = 'Men's Interest'
a.Category_Name = 'Men''s Interest'

 
2009/12/26 nag <nage...@gmail.com>



--
Regards
*******************
*C.Arun Kumar *
*******************



Keidrick Pettaway

unread,
Dec 26, 2009, 10:53:53 AM12/26/09
to dotnetde...@googlegroups.com
Did you really name a category type with an apostrophe in the database? Also what error do you receive when you run your query in the query analyzer?

Keidrick Pettaway
Web:
http://www.kpettaway.com
Twitter:
http://twitter.com/kpett
Linkedin:
http://www.linkedin.com/pub/keidrick-pettaway/8/705/b58


From: ARUN KUMAR <carunku...@gmail.com>
Date: Sat, 26 Dec 2009 21:01:18 +0530
Subject: Re: [DotNetDevelopment] Unclosed quotation mark before the character string ' '

Saif ul Haq Khan

unread,
Dec 26, 2009, 4:43:51 AM12/26/09
to dotnetde...@googlegroups.com
Parse query in this way
 
Select a.Category_Id,
a.Category_Name,b.umc,b.Magazine_Name,Magazine_Description From
[magazine_category] a Inner Join magazine b on a.Category_Id =
b.Category_Id and a.Category_Name = 'Men''s Interest'
Example
string searchText = txtSearchInput.Text;
if xtSearchInput.Text.Contains("'"))
{
searchText = txtSearchInput.Text.Replace("'", "\''");
}
while inserting updatin or view this perform at all functions used in your program
 

--
Regards,
Saif ul Haq khan
Cell : 0092-321-2064901

Atul Setu

unread,
Dec 26, 2009, 2:59:43 AM12/26/09
to dotnetde...@googlegroups.com

With Warm Regards
===============
Atul Setu
+91-98112-20302
+91-95558-00788
atul...@gmail.com
 the red mark is error point.  'Men' is a string and the rest is wat. Please give this as 'Mens Interest'  or you can use Escape Characters for that

nag

unread,
Dec 28, 2009, 12:10:15 AM12/28/09
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
hey dude thank you very much
it wrk awesome...;)

On Dec 26, 2:43 pm, Saif ul Haq Khan <saifkha...@gmail.com> wrote:
> *Parse query in this way*
> **
> *Select a.Category_Id,


> a.Category_Name,b.umc,b.Magazine_Name,Magazine_Description From
> [magazine_category] a Inner Join magazine b on a.Category_Id =
> b.Category_Id and a.Category_Name = 'Men''s Interest'

> *


> Example
> string searchText = txtSearchInput.Text;
> if xtSearchInput.Text.Contains("'"))
> {
> searchText = txtSearchInput.Text.Replace("'", "\''");}
>
> while inserting updatin or view this perform at all functions used in your
> program
>
> --
> Regards,
> Saif ul Haq khan
> Cell : 0092-321-2064901
>
>
>
> On Sat, Dec 26, 2009 at 12:29 PM, nag <nagesh...@gmail.com> wrote:
> > hi friend im getting following error,wen i run
> > DropDownList1_OnSelectedIndexChanged event
>
> > Line 1: Incorrect syntax near 's'.
> > Unclosed quotation mark before the character string ' '.
>
> > here is my query
> > please help me to solve this
>
> > Select a.Category_Id,
> > a.Category_Name,b.umc,b.Magazine_Name,Magazine_Description From
> > [magazine_category] a Inner Join magazine b on a.Category_Id =

> > b.Category_Id and a.Category_Name = 'Men's Interest'- Hide quoted text -
>
> - Show quoted text -

manish thapa

unread,
Dec 30, 2009, 4:26:17 AM12/30/09
to dotnetde...@googlegroups.com
string str="Men's Interest";
Select a.Category_Id,
a.Category_Name,b.umc,b.
Magazine_Name,Magazine_Description From
[magazine_category] a Inner Join magazine b on a.Category_Id =
b.Category_Id and a.Category_Name = '"+str+"'"


It will run properly
Reply all
Reply to author
Forward
0 new messages