473,842 Members | 1,896 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.__ComOb ject'.

Source Error:

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

Line 198: rs_email = conn.execute(se lectsqlstatemen t)
Line 199: tolist = tolist & rs_email("email ") & ";"
Line 200:
Source File: C:\Documents and Settings\amit\W ebSite1\email_f orm.aspx
Line: 198

Stack Trace:

[COMException (0x80040e14): Syntax error in query expression 'id
=System.__ComOb ject'.]
Microsoft.Visua lBasic.Compiler Services.LateBi nding.LateGet(O bject o,
Type objType, String name, Object[] args, String[] paramnames,
Boolean[] CopyBack) +965
Microsoft.Visua lBasic.Compiler Services.NewLat eBinding.LateGe t(Object
Instance, Type Type, String MemberName, Object[] Arguments, String[]
ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack) +193727
ASP.email_form_ aspx.__Render__ control1(HtmlTe xtWriter __w, Control
parameterContai ner) in C:\Documents and
Settings\amit\W ebSite1\email_f orm.aspx:198
System.Web.UI.C ontrol.RenderCh ildrenInternal( HtmlTextWriter writer,
ICollection children) +98
System.Web.UI.C ontrol.RenderCh ildren(HtmlText Writer writer) +20
System.Web.UI.P age.Render(Html TextWriter writer) +27
System.Web.UI.C ontrol.RenderCo ntrolInternal(H tmlTextWriter writer,
ControlAdapter adapter) +53
System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer,
ControlAdapter adapter) +280
System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer) +24

The code for teh foll is,

<%
Dim counter,rs_emai l, tolist
Dim emaillist as string()
dim i as integer
emaillist = split(request.F orm("c"), ",")
counter = 1
dim selectSqlStatem ent as string
for i = 0 to ubound(emaillis t)
selectsqlstatem ent = "select * from tblusers where id =" &
emaillist(i)
rs_email = conn.execute(se lectsqlstatemen t)
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 2348
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*******@gmai l.com> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.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.__ComOb ject'.

Source Error:

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

Line 198: rs_email = conn.execute(se lectsqlstatemen t)
Line 199: tolist = tolist & rs_email("email ") & ";"
Line 200:
Source File: C:\Documents and Settings\amit\W ebSite1\email_f orm.aspx
Line: 198

Stack Trace:

[COMException (0x80040e14): Syntax error in query expression 'id
=System.__ComOb ject'.]
Microsoft.Visua lBasic.Compiler Services.LateBi nding.LateGet(O bject o,
Type objType, String name, Object[] args, String[] paramnames,
Boolean[] CopyBack) +965
Microsoft.Visua lBasic.Compiler Services.NewLat eBinding.LateGe t(Object
Instance, Type Type, String MemberName, Object[] Arguments, String[]
ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack) +193727
ASP.email_form_ aspx.__Render__ control1(HtmlTe xtWriter __w, Control
parameterContai ner) in C:\Documents and
Settings\amit\W ebSite1\email_f orm.aspx:198
System.Web.UI.C ontrol.RenderCh ildrenInternal( HtmlTextWriter writer,
ICollection children) +98
System.Web.UI.C ontrol.RenderCh ildren(HtmlText Writer writer) +20
System.Web.UI.P age.Render(Html TextWriter writer) +27
System.Web.UI.C ontrol.RenderCo ntrolInternal(H tmlTextWriter writer,
ControlAdapter adapter) +53
System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer,
ControlAdapter adapter) +280
System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer) +24

The code for teh foll is,

<%
Dim counter,rs_emai l, tolist
Dim emaillist as string()
dim i as integer
emaillist = split(request.F orm("c"), ",")
counter = 1
dim selectSqlStatem ent as string
for i = 0 to ubound(emaillis t)
selectsqlstatem ent = "select * from tblusers where id =" &
emaillist(i)
rs_email = conn.execute(se lectsqlstatemen t)
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
2477
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" for when and how to use single quotes and double quotes in ASP? thanks! ---------------------- SQL = SQL & "WHERE '" & REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE("GenKTitles.
24
22672
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 quotes? Do I need to use code to scrub each string and remove or escape the double quotes before using it in a query? The error I get is this: Error Number 3075: Syntax error (missing operator) in query expression '"credit card billed by...
1
1665
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 'id =System.__ComObject'. Source Error: Line 191: counter = 1Line 192: for i = 0 to ubound(emaillist)Line 193: rs_email = conn.execute("select * from tblusers where id =" & emaillist(i))Line 194: tolist = tolist & rs_email("email") &...
4
1891
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 MESSAGE) sql_HTTermijnRecords = "select * from Orders where FaktuurGeprint = 'J'" & _ "AND dathergestuurd Is Not Null " & _ "AND PerBankKas Is Null " & _
7
6890
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 expression should return the 4 leftmost characters of the FilmNo
7
2898
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", "OE_HDR"."SLS_MAN_NO", "OE_HDR"."SLS_MAN_INITIALS", "OE_HDR"."ORD_DAT", "OE_HDR"."SHIP_DAT" FROM "OE_HDR" WHERE ("OE_HDR"."ORD_NO"='174310') I also have DropDownList1 working properly. For the WHERE portion of
4
11698
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 & Chr(39) ID here is equal to 1234567890 MsgBox sSQLQuery the msgbox says: SELECT * FROM TblData WHERE ID = '1234567890 Note that the quotation is missing at the end Set rs = db.OpenRecordset(sSQLQuery, dbOpenDynaset)
7
2851
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 the latest patches. If I do not group the query (ie. remove aggregation) it will work. If I recall, it also works if my subquery does not have joins. I want to accomplish this with pure SQL .. I could easily write a VBA function to handle...
5
8838
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 debugging myself). My problem is in the DLookup command. UserName = Me.cboUserName.Value Debug.Print "User Name is "; UserName strPassword = DLookup("Password", "Employees", "EmpName ='" & UserName) Debug.Print "Password is ";...
0
9865
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9709
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10936
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10609
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10303
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9448
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7853
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5882
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4498
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.