Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: sql string error


Message #1 by "Amjad Ali" <Amjad2000@h...> on Fri, 16 Feb 2001 00:02:55
I get an error when I run the code down bellow, the error say 

Invalid column name 'eee'. where eee is the item selected in the dropdown 

box

Her is the code



Forum = Request.QueryString("id")

If Len(Request.QueryString("id")) <> 0 Then

   do while Not RS.EOF 

      RS.MoveFirst

      sql = "DELETE MyForums where forumName=" & Request.QueryString("id")

      rs1 = conn.Execute(strsql)

      rs.movenext

   loop

End If



now when I change the sql line above to 

sql = "DELETE MyForums where forumName='eee'" 

it works fine, any ideas will be appreciated.
Message #2 by "Ken Schaefer" <ken@a...> on Fri, 16 Feb 2001 17:40:34 +1100
The syntax for a delete statement is:



DELETE FROM tablename

WHERE column = 'value'



not what you have...



Also, look at your code:



sql = "DELETE MyForums where forumName=" & Request.QueryString("id")

    -VS-

sql = "DELETE MyForums where forumName='eee'"



Why can't you see that you have ' in the second statement, but not in the

first?



Cheers

Ken



----- Original Message -----

From: "Amjad Ali" <Amjad2000@h...>

To: "ASP Databases" <asp_databases@p...>

Sent: Friday, February 16, 2001 12:02 AM

Subject: [asp_databases] sql string error





> I get an error when I run the code down bellow, the error say

> Invalid column name 'eee'. where eee is the item selected in the dropdown

> box

> Her is the code

>

> Forum = Request.QueryString("id")

> If Len(Request.QueryString("id")) <> 0 Then

>    do while Not RS.EOF

>       RS.MoveFirst

>       sql = "DELETE MyForums where forumName=" & Request.QueryString("id")

>       rs1 = conn.Execute(strsql)

>       rs.movenext

>    loop

> End If

>

> now when I change the sql line above to

> sql = "DELETE MyForums where forumName='eee'"

> it works fine, any ideas will be appreciated.

> ---

> Please take a moment to tell us how you are using AuthentiX, WebQuota, and

> VideoQuota





Message #3 by Wilson Lie <wilson_lie@i...> on Fri, 16 Feb 2001 14:41:23 +0800
	Hi,

		Try to use

	            "delete myforums where forumName= '" &

Request.QueryString("id") & "'"



	Regards,

	Wilson

> -----Original Message-----

> From:	Amjad Ali [SMTP:Amjad2000@h...]

> Sent:	Friday, February 16, 2001 8:03 AM

> To:	ASP Databases

> Subject:	[asp_databases] sql string error

> 

> I get an error when I run the code down bellow, the error say 

> Invalid column name 'eee'. where eee is the item selected in the dropdown 

> box

> Her is the code

> 

> Forum = Request.QueryString("id")

> If Len(Request.QueryString("id")) <> 0 Then

>    do while Not RS.EOF 

>       RS.MoveFirst

>       sql = "DELETE MyForums where forumName=" & Request.QueryString("id")

>       rs1 = conn.Execute(strsql)

>       rs.movenext

>    loop

> End If

> 

> now when I change the sql line above to 

> sql = "DELETE MyForums where forumName='eee'" 

> it works fine, any ideas will be appreciated.

> 
Message #4 by Gregory_Griffiths@c... on Fri, 16 Feb 2001 09:04:30 +0000
try :



sql = "DELETE MyForums where forumName='" & Request.QueryString("id") & 

"'"



instead as a string needs quotes around it.



> -----Original Message-----

> From: Amjad2000@h... [mailto:Amjad2000@h...]

> Sent: 16 February 2001 00:03

> To: asp_databases@p...

> Cc: Amjad2000@h...

> Subject: [asp_databases] sql string error

> 

> 

> I get an error when I run the code down bellow, the error say 

> Invalid column name 'eee'. where eee is the item selected in 

> the dropdown 

> box

> Her is the code

> 

> Forum = Request.QueryString("id")

> If Len(Request.QueryString("id")) <> 0 Then

>    do while Not RS.EOF 

>       RS.MoveFirst

>       sql = "DELETE MyForums where forumName=" & 

> Request.QueryString("id")

>       rs1 = conn.Execute(strsql)

>       rs.movenext

>    loop

> End If

> 

> now when I change the sql line above to 

> sql = "DELETE MyForums where forumName='eee'" 

> it works fine, any ideas will be appreciated.

> 
Message #5 by "Wally Burfine" <oopconsultant@h...> on Fri, 16 Feb 2001 14:20:45 -0000
when you look at the line that works fine and the line that doesn't work, 

you see the difference. Use Reaponse.Write "SQL: " & sql & "<br>" to see the 

sql statement you are submitting to the ADO engine to execute. You will see 

the syntax error. You are missing the ' delimiter.



Regards,

Wally





>From: "Amjad Ali" <Amjad2000@h...>

>Reply-To: "ASP Databases" <asp_databases@p...>

>To: "ASP Databases" <asp_databases@p...>

>Subject: [asp_databases] sql string error

>Date: Fri, 16 Feb 2001 00:02:55

>

>I get an error when I run the code down bellow, the error say

>Invalid column name 'eee'. where eee is the item selected in the dropdown

>box

>Her is the code

>

>Forum = Request.QueryString("id")

>If Len(Request.QueryString("id")) <> 0 Then

>    do while Not RS.EOF

>       RS.MoveFirst

>       sql = "DELETE MyForums where forumName=" & Request.QueryString("id")

>       rs1 = conn.Execute(strsql)

>       rs.movenext

>    loop

>End If

>

>now when I change the sql line above to

>sql = "DELETE MyForums where forumName='eee'"

>it works fine, any ideas will be appreciated.

>

  Return to Index