473,404 Members | 2,179 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,404 software developers and data experts.

Why am I getting this error with my SQL command?

Expand|Select|Wrap|Line Numbers
  1. "SELECT STUNO, FNAME, SNAME FROM STUDENT WHERE E1='4721/01  ' OR E2='4721/01  ' OR E3='4721/01  ' OR E4='4721/01  ' OR E5='4721/01  ' OR E6='4721/01  ' OR E7='4721/01  ' OR E8='4721/01  ' OR E9='4721/01  ' OR E10='4721/01  ' OR E11='4721/01  ' OR E12='4721/01  ' OR E13='4721/01  ' OR E14='4721/01  ' OR E15='4721/01  ' OR E16='4721/01  ' OR E17='4721/01  ' OR E18='4721/01  ' OR E19='4721/01  ' OR E20='4721/01  ' OR E21='4721/01  ' OR E22='4721/01  ' OR E23='4721/01  ' OR E24='4721/01  ' OR E25='4721/01  ';"
I get the error that no value was given for one or more required parameters. This command works fine in Access SQL view, but I get an error when I use it in C#. I think there's an escape character somewhere but I can't figure out what it is. Can anyone help me?
Apr 27 '11 #1

✓ answered by Plater

Does the table STUDENT actually contain columns called "E1" up through "E25"?
Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT STUNO, FNAME, SNAME 
  3. FROM STUDENT 
  4. WHERE 
  5. E1='4721/01  ' 
  6. OR E2='4721/01  ' 
  7. OR E3='4721/01  ' 
  8. OR E4='4721/01  ' 
  9. OR E5='4721/01  ' 
  10. OR E6='4721/01  ' 
  11. OR E7='4721/01  ' 
  12. OR E8='4721/01  ' 
  13. OR E9='4721/01  ' 
  14. OR E10='4721/01  ' 
  15. OR E11='4721/01  ' 
  16. OR E12='4721/01  ' 
  17. OR E13='4721/01  ' 
  18. OR E14='4721/01  ' 
  19. OR E15='4721/01  ' 
  20. OR E16='4721/01  ' 
  21. OR E17='4721/01  ' 
  22. OR E18='4721/01  ' 
  23. OR E19='4721/01  ' 
  24. OR E20='4721/01  ' 
  25. OR E21='4721/01  ' 
  26. OR E22='4721/01  ' 
  27. OR E23='4721/01  ' 
  28. OR E24='4721/01  ' 
  29. OR E25='4721/01  ';
  30.  
  31.  

3 1326
Rabbit
12,516 Expert Mod 8TB
I believe Access SQL uses double quotes as a string delimiter as opposed to single quotes.
Apr 27 '11 #2
Plater
7,872 Expert 4TB
Does the table STUDENT actually contain columns called "E1" up through "E25"?
Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT STUNO, FNAME, SNAME 
  3. FROM STUDENT 
  4. WHERE 
  5. E1='4721/01  ' 
  6. OR E2='4721/01  ' 
  7. OR E3='4721/01  ' 
  8. OR E4='4721/01  ' 
  9. OR E5='4721/01  ' 
  10. OR E6='4721/01  ' 
  11. OR E7='4721/01  ' 
  12. OR E8='4721/01  ' 
  13. OR E9='4721/01  ' 
  14. OR E10='4721/01  ' 
  15. OR E11='4721/01  ' 
  16. OR E12='4721/01  ' 
  17. OR E13='4721/01  ' 
  18. OR E14='4721/01  ' 
  19. OR E15='4721/01  ' 
  20. OR E16='4721/01  ' 
  21. OR E17='4721/01  ' 
  22. OR E18='4721/01  ' 
  23. OR E19='4721/01  ' 
  24. OR E20='4721/01  ' 
  25. OR E21='4721/01  ' 
  26. OR E22='4721/01  ' 
  27. OR E23='4721/01  ' 
  28. OR E24='4721/01  ' 
  29. OR E25='4721/01  ';
  30.  
  31.  
Apr 27 '11 #3
Sfreak
64
Does c# knows that you are passing these quotes to the string?

for example:
Expand|Select|Wrap|Line Numbers
  1. string Ex = "\'hi\'";
  2.  
Apr 27 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Raghul | last post by:
I am getting this error while copying n number of messages to the folder using imaplib.What to do to copy n number of folders in mail The error i got is imaplib.error: command COPY illegal in...
3
by: IMS.Rushikesh | last post by:
Hi Friends, My work is stuck up because of this unresolvable and unbelievable Error. I'm trying to Serialize my Class object using XmlSerialization. And at below line, I m getting "error File...
8
by: Rod | last post by:
I have been working with ASP.NET 1.1 for quite a while now. For some reason, opening some ASP.NET applications we wrote is producing the following error message: "The Web server reported...
0
by: howardr101 | last post by:
Hi, Have hunted around on the groups and can't find anything, hence. I've tried this against 2 mail servers (mailtraq and hmailserver) and it occus with both. The problems seems to be that...
1
by: siddu | last post by:
Hi All, I have to do one task. First i need to copy files from vss and run bat files.i have a document with all steps. step 1: we have to take files from vss by using getlatestversion...
5
by: Archana | last post by:
Hi all, I am having application where i am downloading xml content using webrequest. my code is as below HttpWebRequest lWebRequest = (HttpWebRequest) WebRequest.Create(URL); HttpWebResponse...
2
by: =?Utf-8?B?R3lhbmVuZHJh?= | last post by:
I am using Ajax control(Update Panel) in my web page(ASP.Net 2.0) and putting Report Viewer(Sql Server Reporting Services 2005) Control in it. When I am displaying any report it is coming...
1
by: jonny | last post by:
Went from using Visual Web Develop express to Visual Studio 2005 and getting error when trying to open project. Error message: "One or more projects in the solution could not be loaded for the...
21
vikas251074
by: vikas251074 | last post by:
I am getting error while entry in userid field. When user enter his user id, an event is fired immediately and user id is verified using AJAX method. But I am getting error 'Object doesn't support...
2
by: sony.m.2007 | last post by:
Hi, When i try to set a value for a session variable I'm getting a object refence not set error I tried two methods as below HttpContext.Current.Session.Add("AppStartTime", DateTime.Now);...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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,...
0
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...

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.