469,934 Members | 2,757 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,934 developers. It's quick & easy.

syntax error in query expression in vb.net

I am geting the following error while conv an asp to asp.net
Exception Details: System.Runtime.InteropServices.COMException: Syntax
error in query expression 'id =System.__ComObject'.

Source Error:

Line 196: for i = 0 to ubound(emaillist)
Line 197: selectsqlstatement = "select * from tblusers where id =" &
emaillist(i)

Line 198: rs_email = conn.execute(selectsqlstatement)
Line 199: tolist = tolist & rs_email("email") & ";"
Line 200:
Source File: C:\Documents and Settings\amit\WebSite1\email_form.aspx
Line: 198

Stack Trace:

[COMException (0x80040e14): Syntax error in query expression 'id
=System.__ComObject'.]
Microsoft.VisualBasic.CompilerServices.LateBinding .LateGet(Object o,
Type objType, String name, Object[] args, String[] paramnames,
Boolean[] CopyBack) +965
Microsoft.VisualBasic.CompilerServices.NewLateBind ing.LateGet(Object
Instance, Type Type, String MemberName, Object[] Arguments, String[]
ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack) +193727
ASP.email_form_aspx.__Render__control1(HtmlTextWri ter __w, Control
parameterContainer) in C:\Documents and
Settings\amit\WebSite1\email_form.aspx:198
System.Web.UI.Control.RenderChildrenInternal(HtmlT extWriter writer,
ICollection children) +98
System.Web.UI.Control.RenderChildren(HtmlTextWrite r writer) +20
System.Web.UI.Page.Render(HtmlTextWriter writer) +27
System.Web.UI.Control.RenderControlInternal(HtmlTe xtWriter writer,
ControlAdapter adapter) +53
System.Web.UI.Control.RenderControl(HtmlTextWriter writer,
ControlAdapter adapter) +280
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +24

The code for teh foll is,

<%
Dim counter,rs_email, tolist
Dim emaillist as string()
dim i as integer
emaillist = split(request.Form("c"), ",")
counter = 1
dim selectSqlStatement as string
for i = 0 to ubound(emaillist)
selectsqlstatement = "select * from tblusers where id =" &
emaillist(i)
rs_email = conn.execute(selectsqlstatement)
tolist = tolist & rs_email("email") & ";"

response.Write(rs_email("email")&";")

if counter = 3 then
response.Write("<br>")
counter = 1
end if

counter = counter + 1
next
%>

Nov 19 '05 #1
1 2089
three syntax errors in a row... Impressive.
clearly, the value of the expression emaillist(i) isn't what you expect it
to be.

why not run through a debugger and see what the values are and compare them
to what you'd expect them to be?

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
<am*******@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
I am geting the following error while conv an asp to asp.net
Exception Details: System.Runtime.InteropServices.COMException: Syntax
error in query expression 'id =System.__ComObject'.

Source Error:

Line 196: for i = 0 to ubound(emaillist)
Line 197: selectsqlstatement = "select * from tblusers where id =" &
emaillist(i)

Line 198: rs_email = conn.execute(selectsqlstatement)
Line 199: tolist = tolist & rs_email("email") & ";"
Line 200:
Source File: C:\Documents and Settings\amit\WebSite1\email_form.aspx
Line: 198

Stack Trace:

[COMException (0x80040e14): Syntax error in query expression 'id
=System.__ComObject'.]
Microsoft.VisualBasic.CompilerServices.LateBinding .LateGet(Object o,
Type objType, String name, Object[] args, String[] paramnames,
Boolean[] CopyBack) +965
Microsoft.VisualBasic.CompilerServices.NewLateBind ing.LateGet(Object
Instance, Type Type, String MemberName, Object[] Arguments, String[]
ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack) +193727
ASP.email_form_aspx.__Render__control1(HtmlTextWri ter __w, Control
parameterContainer) in C:\Documents and
Settings\amit\WebSite1\email_form.aspx:198
System.Web.UI.Control.RenderChildrenInternal(HtmlT extWriter writer,
ICollection children) +98
System.Web.UI.Control.RenderChildren(HtmlTextWrite r writer) +20
System.Web.UI.Page.Render(HtmlTextWriter writer) +27
System.Web.UI.Control.RenderControlInternal(HtmlTe xtWriter writer,
ControlAdapter adapter) +53
System.Web.UI.Control.RenderControl(HtmlTextWriter writer,
ControlAdapter adapter) +280
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +24

The code for teh foll is,

<%
Dim counter,rs_email, tolist
Dim emaillist as string()
dim i as integer
emaillist = split(request.Form("c"), ",")
counter = 1
dim selectSqlStatement as string
for i = 0 to ubound(emaillist)
selectsqlstatement = "select * from tblusers where id =" &
emaillist(i)
rs_email = conn.execute(selectsqlstatement)
tolist = tolist & rs_email("email") & ";"

response.Write(rs_email("email")&";")

if counter = 3 then
response.Write("<br>")
counter = 1
end if

counter = counter + 1
next
%>

Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by amitbadgi | last post: by
4 posts views Thread by T. Wintershoven | last post: by
7 posts views Thread by John Øllgård Jensen | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.