Entering info into MSSQL db from a form

Hi,
I'm trying to enter data into a msSQL 7 db using a form. As long as the information I enter is an integer, it works fine, but if I enter a name like john for "enter name" in the form, I get the following error:
javax.servlet.ServletException: [Microsoft] [ODBC SQL Server Driver] [SQL Server] the name 'john' is not permitted in this context. Only constants, expressions, or variables allowed here. Column names are not permitted. at org.apache.jasper.runtime.PageContextImpl.handlePage Exception(PageContextImpl.java:457)
The datatype for 'name' is VARCHAR and I'm able to enter 'John' manually in the database, but not through the form.
The code for the jsp that processes my form is:
<html>
<head></head>
<%@ page import="java.sql.*" %>
<body>
<%
String userName=request.getParameter("userName");
String employeeID=request.getParameter("employeeID");
String phoneExtension=request.getParameter("phoneExtension");
%>
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:doron","user","password");
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
String sqlStatement = "INSERT INTO Employees(employee_id,name,extension) VALUES ("+employeeID+","+userName+","+phoneExtension+")";
stmt.executeUpdate(sqlStatement);
con.close();
%>
Thank you.
</body>
</html>
Does anyone have any ideas??

Your SQL statement doesn't seem to be putting quotes around the employee name, so what you are submitting to the database is something like
Insert ... Values(23, John, 4406)
whereas it should be
Insert ... Values(23, 'John', 4406)

Similar Messages

  • Entering info into "category"

    Anyone know how to enter info into the "category" heading for an iTunes selection? When I "get info" for an iTunes selection, I do not see the "Category" heading that is offerd in "view options".
    Many thanks.

    Richard,
    I'm so glad you posted this question. I just discovered the mysterious "category" field today. The following post discusses it a bit, but I'm hoping to find out more.
    Bensch, "How do I use the new fields "category" or "description"?", 06:10pm Sep 7, 2005 CDT

  • How can I get my wireless keyboard and my new magic mouse to enter info into a Christmas list app on iphone 3GS? Do I have to move to another room? I have bluetooth on in my iPhone.

    I have wireless keyboard and a new magic mouse. I want to enter data into a Christmas list app on my 3GS iPhone. Too time consuming to just type on iPhone keyboard. How can I get keyboard and mouse to be 'connected' or recognized by my iPhone? I have Bluetooth "on" in my iPhone.

    You cannot connect the mouse.  This is not a feature of iphone
    You can learn about connecting a keyboard in the manual:
    iPhone User Guide (For iOS 5.0 Software)

  • How to insert a JPG file into a Table from a Form?

    I create a Schema and a Table as follows:
    SQL> create user myphoto identified by myphoto;
    User created.
    SQL> grant connect,resource to myphoto;
    Grant succeeded.
    SQL> create table myphoto.photo_table
    2 (photo_id varchar2(10) primary key,
    3 photo_content blob);
    Table created.
    I would like to build an Oracle Form with a Text Item to enter the full path and filename to be uploaded and inserted into the photo_table; and a Push Button to insert the jpg file into the photo_table.
    Can any one give me details on how this could be done?

    Hi,
    have a look at webutil on otn.oracle.com/products/forms ---> Webutil
    Webutil has the capability to load files into the database.
    Frank

  • HT1677 Enter info into auto fill on iPad 4

    I enter sweepstakes and need an auto fill for this -how do I enter my contact information into auto fill in safari

    After enabling Auto Fill (Settings>Safari), Safari will ask you about remembering User ID and Password Data as your enter it for the first time. After that it will Auto Fill for you.

  • Help with inserting Date into MySQL DB from registration form input

    I'm trying to automatically input the registration date of a customer into my MySQL DB. Nothing seems to work. I've tried timestamp in a table field, I've tried a hidden field in the form. Any suggestions?

    You can use NOW() in the insertion record code, it will display like a time stamp format (date + time). Otherwise u can use this if u just want to store the date, $today = date("j F Y "); . It will display like 21 May 2009. Further information about date() function you can get it HERE.

  • Add more than one entry into a database from single form

    I have a page that has 1 form that allows you to add 1 job.
    I want to be able to have a button or something that says add
    job and add another job.
    When creating the database I did not create a table to hold
    the order just add the job.
    I am attempting to create a new version of the site with
    order referencing job_id and customer_id so that a job can belong
    to an order. And I can an order that has many jobs.
    What is the best way I can do this and then I will need it to
    be displayed on the invoice.
    I also need to beable to create an invoice for the particular
    job.
    but that does not need to be done here.

    I have posted previously, but the requirement from my friend
    has changed somewhat.
    I have a add job page (add.php) and I need to add a
    button/link to add more fields of the same to add a job to the
    chosen customer.

  • Entering info into the music files

    I am using iTunes 10. After upgrading from iTunes 9 I am no longer able to edit the info for each "album". I have tried everything. Can anyone help ?

    You don't mention what info you would like to edit.
    Try right clicking an album or track and left clicking on Get Info.

  • Error Message when entering data into a table from an array

    When i use the following:
    stmt.executeUpdate("INSERT INTO Car " + "VALUES (" + temp + ", " + carData[0] + ", " + carData[1] + ", " + carData[2] + ", " + carData[3] + ", " + carData[4] + ", " + carData[5] + ", " + carData[6] + ", " + carData[7] + ", " + carData[8] + ", " + carData[10] + ", " + carData[11] + ", " + carData[12] + ", " + carData[9] + ", " + carData[13] + ", " + carData[14] + ", " + carData[15] + ", " + carData[16] + ", " + carData[17] + ", " + carData[18] + ", " + carData[19] + ", " + carData[20]+")");
    i get the following error message:
    SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Audi A2 (Standard & SE)'.
    where: 'Audi A2 (Standard & SE)' is the value stored in carData[4].
    Can anyone help?

    You need to enclose carData[0],carData[1] etc in single quotes, if they are String(s). Otherwise you can use PreparedStatement.
    PreparedStatement ps = con.prepareStatement("Insert into car values(22 questions marks)");
    ps.setInt(1,temp);
    for(int i=0;i<21;i++) ps.setString(i+2,carData[ i ]);
    int count=ps.executeUpdate();
    Sudha

  • How to enter text into text box in Pages '09

    When I manually select a text boxes in Pages, I can paste text into them. I can move from text box to text box using System Events to keystroke tabs but have not figured out how to get Applescript Editor to make the pastes. I am trying to use Applescript Editor to enter text into a pages document that is formatted for labels.

    I have downloaded template U-0089-02_P.doc from Avery, 14 boxes displayed in two columns of seven rows.
    Once you have clicked in the upper left box, the following script should enter text into every box, from left to right and top to bottom.
    tell application "Pages"
    activate
    tell application "System Events"
    keystroke "Box 1"
    keystroke tab & tab -- to go to the next column
    keystroke "Box 2"
    keystroke tab -- to go to the next row
    keystroke "Box 3"
    keystroke tab & tab
    -- and so on
    end tell
    end tell
    The problem is that I don't know how to enter the upper left box from the AppleScript Editor.

  • HT4991 Although I entered info in several Numbers spreadsheets within the last hour, now I can't input info in another.  Nor can I go to any others.  I'm locked up in one spreadsheet and can't move out of it.  Any ideas?

    Altho I entered info into several Numbers spreadsheets, I have locked up in another one.  Any ideas?

    Altho I entered info into several Numbers spreadsheets, I have locked up in another one.  Any ideas?

  • Any way to have info from a form show in the body of an email window?

    I've built a question form in the new Catalyst Beta that when completed, the user will click the submit button opening their email client(which, since this is an internal app for my office, is MS Outlook) showing the information already entered and they just have to hit Send.
    I have imported the FC file into Flash Builder 4 and have been able to populate the To and Subject fields but I'm having trouble with the body of the email. I can't think of/find a way to link/export the info from the form to the email body. Anyone have any suggestions or ideas?
    Thanks.

    user457097 wrote:
    Is it possible to do using plain text?No. mailto is an HTML tag. The only way for the email client to be able to interpret it properly is to send an HTML message with the mailto tag.
    Many mail clients will automatically take text that looks like URLs or email addresses in a plain text email and make them links. If this is an internal application where you know what mail client everyone is using, that may be worth testing out. You may not need a mailto.
    Justin

  • Linking data from PDF form into Indesign CS6

    Hello all,
    I'll be working on a magazine which has a large section of day camps technical descriptions :
    name, contact info, location, short introduction text, activities icons (they have to choose up to 5 icons from a total of 12)
    Is it possible to link data from a fillable PDF into predetermined and prestyled text boxes in Indesign CS6?
    Would it be necessary to export in an Excel sheet prior?
    What would be the best trick in order for the icons to place themselves automatically, if possible?
    Thanks in advance

    When placing a PDF into InDesign, it's a flat piece of art for each page included. There's no way to manipulate form fields or work with links or anything like that.
    The data from the form would have to be collected and converted into an Excel file for placing into InDesign. (Collecting data from PDF forms and converting the Excel format can be done in Acrobat Pro.)

  • Excel crashes when entering data from VBA form

    After only 6 lines of data entered via VBA form with macros enables, excel crashes everytime. The code basically looks for the next empty row and then populates sheet with data from the form.
    Is this known bug or is there something in the code causing this. I have tried on a couple of macs and get the same result.
    Will post code here and the CRASH code ....
    This is the code
    Private Sub CommandButton1_Click()
    'Dim lRow As Integer
    Dim lRow As Long
    Dim ws As Worksheet
        Set ws = Worksheets("FamilySunday")
       lRow = ws.Cells.Find(what:="*", searchorder:=xlRows, searchdirection:=xlPrevious, LookIn:=xlValues).Row + 1
       'lRow = ws.Cells.Find(what:="*", searchorder:=xlRows, searchdirection:=xlPrevious, LookIn:=xlValues).Row + 1
        With ws
        Cells(lRow, 1).Value = Me.txtName.Value
        Cells(lRow, 2).Value = Me.txtEmail.Value
        Cells(lRow, 3).Value = Me.txtFacebook.Value
        Cells(lRow, 4).Value = Me.txtMobile.Value
        Cells(lRow, 5).Value = Me.txtDate.Value
        If OptionButton1.Value = True Then
        Cells(lRow, 6).Value = "Face Book"
        ElseIf OptionButton2.Value = True Then
        Cells(lRow, 6).Value = "Twitter"
        ElseIf OptionButton3.Value = True Then
        Cells(lRow, 6).Value = "Skating Heaven web site"
    Else
        Cells(lRow, 6).Value = "Friends"
            End If
        Cells(lRow, 10).Value = Me.txtParty.Value
        End With
        'Clears the form for new entry
        Me.txtName.Value = ""
        Me.txtEmail.Value = ""
        Me.txtFacebook.Value = ""
        Me.txtMobile.Value = ""
        Me.txtParty.Value = ""
        Me.txtDate.Value = ""
        Unload Me
        frmDisclaim.Show
        ActiveWorkbook.Save
    End Sub
    Private Sub CommandButton2_Click()
    Unload Me
    ActiveWorkbook.Save
    Application.DisplayAlerts = False
    Application.Quit
    Application.DisplayAlerts = False
    End Sub
    Private Sub txtName_Change()
    'This will add date of entry which is hidden from view
    Me.txtDate.Value = Format(Date, "Medium Date")
    End Sub
    And this is the CRASH CODE
    Process:         Microsoft Excel [243]
    Path: /Users/useruser/Desktop/Microsoft Office 2004/Microsoft Excel
    Identifier:      com.microsoft.Excel
    Version:         111101 (11.6.6)
    Code Type:       PPC (Translated)
    Parent Process:  launchd [64]
    Interval Since Last Report:          12933 sec
    Crashes Since Last Report:           2
    Per-App Interval Since Last Report:  1251 sec
    Per-App Crashes Since Last Report:   2
    Date/Time:       2012-04-19 01:39:36.568 +0100
    OS Version:      Mac OS X 10.5.8 (9L31a)
    Report Version:  6
    Anonymous UUID:  1EA8AF14-BFEA-4D77-B4AD-582D3EC7D271
    Exception Type:  EXC_BAD_ACCESS (SIGBUS)
    Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000001
    Crashed Thread:  0
    Thread 0 Crashed:
    0   translate 0xb80bcd58 0xb8000000 + 773464
    1   translate 0xb80b7007 0xb8000000 + 749575
    2   translate 0xb80d49c0 0xb8000000 + 870848
    3   translate 0xb813ce79 spin_lock_wrapper + 1981
    4   translate 0xb8011b64 0xb8000000 + 72548
    Thread 1:
    0   ??? 0x800bc166 0 + 2148254054
    1   ??? 0x800c395c 0 + 2148284764
    2   translate 0xb818b6ea CallPPCFunctionAtAddressInt + 202886
    3   ??? 0x800ed055 0 + 2148454485
    4   ??? 0x800ecf12 0 + 2148454162
    Thread 2:
    0   translate 0xb81529ef spin_lock_wrapper + 90931
    1   translate 0xb8183633 CallPPCFunctionAtAddressInt + 169935
    2   translate 0xb81861e2 CallPPCFunctionAtAddressInt + 181118
    3   translate 0xb80dfb0b 0xb8000000 + 916235
    4   ??? 0x812d7856 0 + 2167240790
    Thread 3:
    0   translate 0xb815289e spin_lock_wrapper + 90594
    1   translate 0xb816e8a7 CallPPCFunctionAtAddressInt + 84547
    2   translate                              0xb80dfb0b 0xb8000000 + 916235
    3   ??? 0x81b75cb6 0 + 2176277686
    Thread 0 crashed with X86 Thread State (32-bit):
    eax: 0x00000000  ebx: 0xb80bcd30  ecx: 0x00000001  edx: 0x00000003
    edi: 0x00000001  esi: 0x80303820  ebp: 0xb7fffa08  esp: 0xb7fff9d0
       ss: 0x0000001f efl: 0x00010206  eip: 0xb80bcd58   cs: 0x00000017
       ds: 0x0000001f   es: 0x0000001f   fs: 0x00000000   gs: 0x00000037
    cr2: 0x00000001
    Binary Images:
    0xb8000000 - 0xb81d7fe7  translate ??? (???) /usr/libexec/oah/translate
    Translated Code Information:
    Rosetta Version:  21.03
    Args: /System/Library/Frameworks/Carbon.framework/Versions/A/Support/LaunchCFMApp /Users/useruser/Desktop/Microsoft Office 2004/Microsoft Excel
    Exception: EXC_BAD_ACCESS (0x0001)
    Thread 0: (0xb009a83c, 0xb81529ef)
    0x00833000: No symbol
    0x00659204: /Users/useruser/Desktop/Microsoft Office 2004/Office/ShMem.bundle/Contents/MacOS/ShMem : _MerpUnregisterCFMFragment + 3156
    0x944fd074: /usr/lib/libSystem.B.dylib : __pthread_body + 40
    0x00000000: /System/Library/Frameworks/Carbon.framework/Versions/A/Support/LaunchCFMApp :   + 0
    PPC Thread State
    srr0: 0x00000000        srr1: 0x00000000 vrsave: 0x00000000
    cr: 0xXXXXXXXX              xer: 0x00000000 lr: 0x94472fa0                        ctr: 0x9446c070
    r00: 0xffffffe1             r01: 0xf0080d60         r02: 0x00000001         r03: 0xf0080e4c         
    r04: 0x00000102         r05: 0x00000000         r06: 0x00000054         r07: 0x00003403        
    r08: 0x000003e8         r09: 0x00000000         r10: 0x000eb018         r11: 0xa076368c        
    r12: 0x9446c070         r13: 0x00000000         r14: 0x00000000         r15: 0x00000000        
    r16: 0x00000000         r17: 0x00000000         r18: 0x00000000         r19: 0x00000000        
    r20: 0x00000000         r21: 0x00000000         r22: 0x00000000         r23: 0x00000000        
    r24: 0xf0080e4c          r25: 0x00000054         r26: 0x00003403         r27: 0x000003e8        
    r28: 0x00000000         r29: 0x00000102         r30: 0x00000102         r31: 0x00663fb0        
    Thread 1: (0xb011ce20, 0xb815289e)
    0x944af1d8: /usr/lib/libSystem.B.dylib : __pthread_cond_wait + 1260
    0x91f57944: /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonC ore.framework/Versions/A/CarbonCore : _TSWaitOnConditionTimedRelative + 244
    0x91f57718: /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonC ore.framework/Versions/A/CarbonCore : _TSWaitOnSemaphoreCommon + 432
    0x91f898ac: /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonC ore.framework/Versions/A/CarbonCore : _TimerThread + 72
    0x944fd074: /usr/lib/libSystem.B.dylib : __pthread_body + 40
    0x00000000: /System/Library/Frameworks/Carbon.framework/Versions/A/Support/LaunchCFMApp :   + 0
    PPC Thread State
    srr0: 0x00000000        srr1: 0x00000000 vrsave: 0x00000000
    cr: 0xXXXXXXXX              xer: 0x20000000 lr: 0x944af218                        ctr: 0x9446c0f0
    r00: 0xffffffd9             r01: 0xf0101c90          r02: 0xa075e53c          r03: 0x00005e03        
    r04: 0x00006103         r05: 0x00000000         r06: 0x0aa34c10          r07: 0x00000000        
    r08: 0x00000000         r09: 0x00000001         r10: 0xf0101e48          r11: 0xa0763a74        
    r12: 0x9446c0f0          r13: 0x00000000         r14: 0x00000000         r15: 0x00000000        
    r16: 0x00000000         r17: 0x00000000         r18: 0x00000000         r19: 0x00000000        
    r20: 0xa035986c         r21: 0x92037570         r22: 0x92037570         r23: 0x00000000        
    r24: 0x00000000         r25: 0x00000001         r26: 0xf0101e48          r27: 0xa075ed00        
    r28: 0xa0351bc4         r29: 0xa075e53c          r30: 0xa0351bf8          r31: 0x944aed00        
    Thread 2: Crashed (0xb7fff9d0, 0xb80bcd58)
    0x767dcd34: No symbol
    0x767e25d8: No symbol
    0x7678010c: No symbol
    0x76792208: No symbol
    0x767eaa98: No symbol
    0x76773ebc: No symbol
    0x767dcd34: No symbol
    0x76808188: No symbol
    0x76815f0c: No symbol
    0x767dcd34: No symbol
    0x76767314: No symbol
    0x76773e38: No symbol
    0x767e9188: No symbol
    0x767e8cf0: No symbol
    0x767f1064: No symbol
    0x767f2f5c: No symbol
    0x7681cbcc: No symbol
    0x767fd7c0: No symbol
    0x7680563c: No symbol
    0x767e8cf0: No symbol
    0x767f1064: No symbol
    0x767e50fc: No symbol
    0x767e5020: No symbol
    0x767e54e8: No symbol
    0x7680cbbc: No symbol
    0x763d0b88: No symbol
    0x763cf824: No symbol
    0x76397520: No symbol
    0x76455e94: No symbol
    0x763abca8: No symbol
    0x763a8e68: No symbol
    0x763a8d6c: No symbol
    0x763bb110: No symbol
    0x763bb2c8: No symbol
    0x76390850: No symbol
    0x7639091c: No symbol
    0x00902e8c: No symbol
    0x7652b078: No symbol
    0x76517ff4: No symbol
    0x00971b90: No symbol
    0x7631ec60: No symbol
    0x7631ee30: No symbol
    0x765361c4: No symbol
    0x765374ac: No symbol
    0x76537ad0: No symbol
    0x7681947c: No symbol
    0x767e3e60: No symbol
    0x767e0234: No symbol
    0x767e55a4: No symbol
    0x76774cc0: No symbol
    0x7676f198: No symbol
    0x7676f248: No symbol
    0x7676f278: No symbol
    0x76781c54: No symbol
    0x767dcd34: No symbol
    0x7680faac: No symbol
    0x7682ad04: No symbol
    0x76817bdc: No symbol
    0x767dcd34: No symbol
    0x76773b58: No symbol
    0x767f168c: No symbol
    0x767f3490: No symbol
    0x763b2594: No symbol
    PPC Thread State
    srr0: 0x00000000        srr1: 0x00000000 vrsave: 0x00000000
    cr: 0xXXXXXXXX              xer: 0x20000000 lr: 0x767e25d8                       ctr: 0x7679b670
    r00: 0x767e25d8         r01: 0xbffafec0            r02: 0x177a0000         r03: 0x00000001        
    r04: 0xbffaffe8            r05: 0x177b2024         r06: 0x00000044         r07: 0x00000002        
    r08: 0xbffb0058          r09: 0xbffb0048          r10: 0x00000000         r11: 0x177bd71c        
    r12: 0x177a1094         r13: 0x15c69b48         r14: 0x00000002         r15: 0x15637d20        
    r16: 0x15637d20         r17: 0x00000001         r18: 0x156844ec         r19: 0x00001081        
    r20: 0x15c032e0         r21: 0x00000000         r22: 0x00000004         r23: 0x1ad300d0        
    r24: 0x1ad300d0         r25: 0x00000000         r26: 0x00000000         r27: 0xffffffff 
    r28: 0xfffffd37            r29: 0xbffaffe8            r30: 0xbffaff50            r31: 0xbffaffe8           

    The issues you describe have nothing to do with the other posting you are referencing. They state they have the following problem:
    (numbers on ipad) drops several of the important features that I created in the laptop version such as headers and footers, fonts, steppers, sliders, etc.
    It sounds like your having no data entry at all. There is a known issue with certain formulas causing crashes, but not every data entered like you seem to be stating.
    I might have missed it, but did you delete and reinstall Numbers on your ipad?
    If not, please write down EXACTLY the steps used to reproduce the problem, then go to http://www.apple.com/feedback and input this into a bug report for ipad numbers. Be very specific as to the steps involved to get to the crash point.
    Thanks
    Jason

  • Downloaded adobe reader, i have been inputting info into some forms, the areas I populate all have red squares around them, what does this mean?

    downloaded adobe reader, i have been inputting info into some forms, the areas I populate all have red squares around them, what does this mean? mac book pro as well. The forms i have been working on are from Canada Immigration, has any one else experienced this? thanks and yes I am new here, lol.

    Yes thank you I figured it out. Lol
    Sent from Samsung Mobile

Maybe you are looking for

  • The error 16 when launching Photoshop elements 12

    Ok I keep getting the error 16 when launching Photoshop elements 12, 1) It says to re-install (did that and did not work twice), there is also the Cache.db unlock (did that - not a solution either)... I need more information on what the problem could

  • Uploading the contents of file into  custom table

    Hi , I have a req where in i want to put the contents of the file into the Z table . I have taken a file upload UI element and in that i have taken 4 attributes as file name f, file type ,file size and file contents and binded this file contents to t

  • Need help with a website

    I am using adobe Flash CS3 to make a website. All is going well, but there are one problem, I can't find anything about how to make the website to upload into my liking. With this I mean that; (the scale (size) is 550x400 pix) I want the website to s

  • Limited "View As" Choices in Media Browser (CS4)

    I am just getting acquainted with Premier Pro and I am using Clasroom in a Book to get a feel for the application. I am working on a lesson that uses P2 media examples. According to the instructions, I am supposed to select "Panasonic P2" in the wind

  • Oracle +ve time management vs SAP -ve time management

    Hello Experts, Currently our client is using oracle where if any employee works more than his planned time and any extra hours, it automatically shows the OT hours and upon his manager approval this will be included in payroll. As ESS in scope with n