473,320 Members | 1,949 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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 2323
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

29
by: shank | last post by:
1) I'm getting this error: Syntax error (missing operator) in query expression on the below statement. Can I get some advice. 2) I searched ASPFAQ and came up blank. Where can find the "rules"...
24
by: deko | last post by:
I'm trying to log error messages and sometimes (no telling when or where) the message contains a string with double quotes. Is there a way get the query to insert the string with the double...
1
by: amitbadgi | last post by:
I am gettign this error while converting an asp application to asp.net , its a query syntax error, Exception Details: System.Runtime.InteropServices.COMException: Syntax error in query expression...
4
by: T. Wintershoven | last post by:
Hi Can someone please tell me whats wrong with the last line of the query below. The first three lines work fine but when i add the fourth line i get an error message (see text at ERROR...
7
by: John Øllgård Jensen | last post by:
Hi Using MS Asccess 2000: In a query I'm trying to create a new field with following expression: FilmDate: Left(,4) The field "FilmNo" is another text field in the query. This is...
7
by: bryant | last post by:
Hi all. I am new to ASP and working in Expression Web. The following query displays the information I need in the gridview for a single record. SELECT "OE_HDR"."ORD_NO", "OE_HDR"."CUST_NAM",...
4
by: srinathvs | last post by:
Hi, I have an access db that I am trying to query from a vb6 program. I've the following code: Dim sSQLQuery As String sSQLQuery = "SELECT * FROM TblData WHERE ID = " & Chr(39) & ID &...
7
by: Yesurbius | last post by:
I am receiving the following error when attempting to run my query. In my mind - this error should not be happening - its a straight-forward query with a subquery. I am using Access 2003 with all...
5
by: rolltide | last post by:
I've seen many similar threads, but despite repeated efforts I cannot figure out my problem. I am running Access 2003, VB 6.5, Office XP Pro. Code excerpt is below (you can see where I've tried...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.