473,385 Members | 1,780 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,385 software developers and data experts.

Retrieve set of records starting with a alphabet

hi..friends..
I am currently developing a project in jsp using access as the back end
I need to find the maximum value of the id from the list of names starting with a particular character. i get the character from the previous page using request.getParameter() method..when i execute it i get an sql exception sayin too few parameters.. My code goes here..

Expand|Select|Wrap|Line Numbers
  1.  
  2. String select_query1="";
  3. v=request.getParameter("val");
  4. try
  5.     {
  6.     Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  7.     Connection con1=DriverManager.getConnection("jdbc:odbc:name","","");
  8.     Statement st1=con1.createStatement();
  9.     select_query1="select Max(ID)as di from indianbaby_boysname where name Like "+'"'+v+'*'+'"';
  10.     out.println(select_query1);
  11.     ResultSet rs1=st1.executeQuery(select_query1);
  12.     while(rs1.next())
  13.     {
  14.         cntid=rs1.getInt("di");
  15.     }
  16.     rs1.close();
  17.     con1.close();
  18.     }catch(Exception e)
  19.     {
  20.         out.println(e);
  21.     }
  22. }
  23.  
  24.  
Sep 9 '08 #1
2 1485
Ferris
101 100+
hi

you miss a space between "Max(ID)" and "as" in line 8 , and I think you should use % replace * to pattern multi-chars.

Expand|Select|Wrap|Line Numbers
  1. select_query1="select Max(ID) as di from indianbaby_boysname where name Like "+'"'+v+'%'+'"';
and what's the output in line 9?
Sep 9 '08 #2
acoder
16,027 Expert Mod 8TB
Note that JavaScript and JSP are two completely different languages. This is a JSP question and JSP questions belong to the Java forum where I've moved this thread to.

Moderator.
Sep 9 '08 #3

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

Similar topics

5
by: Rich Protzel | last post by:
Hello, If I run an action SP from MS Access using ADO: ... cmd.execute where the SP is something like Create... Update tbl1 set fld1 = 'something' where... how can I retrive the count of...
5
by: Stefan Krah | last post by:
Hello, I am currently writing code where it is convenient to convert char to int . The conversion function relies on a character set with contiguous alphabets. int set_mesg(Key *key, char...
8
by: Jack Addington | last post by:
I want to scroll through the alphabet in order to scroll some data to the closest name that starts with a letter. If the user hits the H button then it should scroll to the letter closest to H. ...
2
by: Rey | last post by:
Howdy all. This may have been covered previously but I've had no success in retrieving it... Where may I find what the limitations are of the various controls, i.e. number of records/items that...
1
by: Kas_aspnet | last post by:
Hi, I have to display a sequence of records in an Aspx page. The problem is, i have to display the records by checking conditions like Classic ASP. For example, consider an employee table. In...
13
by: kev | last post by:
Hi all, I have created a database for equipments. I have a form to register the equipment meaning filling in all the particulars (ID, serial, type, location etc). I have two buttons at the end...
0
by: padhuwork | last post by:
Hi, I want to create a Windows DLL using VC++ 6.0 which connects to SQL Server. After establishing the connection, I want to retrieve records from table (query) and out put the recordset to a...
4
by: LetMeDoIt | last post by:
Greetings, I'm using ASP to retrieve from MSSQL and I then populate a table. After several months of successfull retrieves, this same code now bombs out. It turns out that if I clear out from...
4
by: questionit | last post by:
How do i retreive 10 rows from a table using SQL SELECT Names from Customers... how do i change it to retrieve only 'n' number of rows? Please suggest an easy method Thanks
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...

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.