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

how do i insert into database.

44
i'm creating a an web application in which a user after selecting the categories he gets all the student info who has taken that subject.

my problem is i'm able to get the multiple student with the text box where a user can put up his monthly attendance. how do i insert the info in database...

the snapshot of the code is here...
here I'm getting the roll no. along with the text box..

Expand|Select|Wrap|Line Numbers
  1. String str1 = "select roll_no from student where sem_id = (select sem_id from subject where course_id ='bsc_it' and sub_id = '"+getsub1+"')";
  2.                                             ResultSet rs  = stmt.executeQuery(str1);
  3.                                 %>
  4.                             <table  align="center" width="" cellpadding="0" cellspacing="0" border="1" cellspacing="1" cellpadding="1">
  5.                                      <tr>
  6.                                         <td><input type="text"  value="Total Lecture" readonly=""/></td>
  7.                                         <td><input type="text" name="total_att" maxlength="2"></td>
  8.                                      </tr>
  9.                                      <tr>
  10.                                         <td><input type="text" value="Student roll no." readonly="" /></td>
  11.                                      </tr>
  12.                                         <%            while(rs.next())
  13.                                                     {
  14.                                         %>            
  15.  
  16.                                         <%
  17.                                                         stu_roll = rs.getString("roll_no");
  18.                                         %>
  19.                                      <tr bordercolor="#CC3366">
  20.                                         <td>
  21.                                         <%        
  22.                                                         out.println(stu_roll);                                                    
  23.                                         %>
  24.                                         </td>
  25.                                         <td>
  26.                                           <input type="text"  name="att" />
  27.                                         </td>
  28.                                     </tr>&nbsp;
  29.  
  30.  
  31.  
  32.                                 <%
  33.                                         }
  34.  
  35.                                             con.close();
  36.                                         }
  37.                                         catch(SQLException e)
  38.                                         {
  39.                                             out.println("Exception in SQL" + e);
  40.                                         }
  41.                                 %>
Feb 16 '08 #1
1 1156
Dököll
2,364 Expert 2GB
Greetings!

You have select roll_no from, you need insert roll_no, thisandthat, thatandtheother, into YourTabe values("yourfiledname1,yourfiedname2, etc...)

thisandthat, thatandtheother, are other fields with data your users may need to access, to add to your db back-end.

Thank you for posting your code:-)

Dököll
Dec 8 '08 #2

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

Similar topics

16
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
3
by: Shapper | last post by:
Hello, I have created 3 functions to insert, update and delete an Access database record. The Insert and the Delete code are working fine. The update is not. I checked and my database has all...
7
by: David Bear | last post by:
I have a dictionary that contains a row of data intended for a data base. The dictionary keys are the field names. The values are the values to be inserted. I am looking for a good pythonic...
5
by: Bonzol | last post by:
Hello, PHP n00b here. Using SQL just working off some examples, I have no problem selecting data, but I cant seem to be able to insert. If someone could see where im going wrong <!DOCTYPE...
14
by: Ben | last post by:
I don't know whether anyone can help, but I have an odd problem. I have a PSP (Spyce) script that makes many calls to populate a database. They all work without any problem except for one...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
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....

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.