Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / August 2005

Tip: Looking for answers? Try searching our database.

syntax error in query expression in vb.net

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
amitbadgi@gmail.com - 12 Aug 2005 06:56 GMT
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.NewLateBinding.LateGet(Object
Instance, Type Type, String MemberName, Object[] Arguments, String[]
ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack) +193727
  ASP.email_form_aspx.__Render__control1(HtmlTextWriter __w, Control
parameterContainer) in C:\Documents and
Settings\amit\WebSite1\email_form.aspx:198
  System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer,
ICollection children) +98
  System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +20
  System.Web.UI.Page.Render(HtmlTextWriter writer) +27
  System.Web.UI.Control.RenderControlInternal(HtmlTextWriter 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
            %>
Nick Malik [Microsoft] - 12 Aug 2005 07:26 GMT
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?

Signature

--- 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.
--

> I am geting the following error while conv an asp to asp.net
> Exception Details: System.Runtime.InteropServices.COMException: Syntax
[quoted text clipped - 61 lines]
> next
>       %>

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.