Updating checkboxes in an Access Database

I have an edit form that requires checkboxes. I select a
record to edit and check the checkboxes, enter the text data and
submit the data. When I select the same record from the edit list I
see where the text data is available in the form, but the
checkboxes are back to the "default" unchecked.
<cfoutput query="pubrec">
<form action="update.cfm" method="post">
<input type="hidden" name="cust_id" value="#cust_id#">
<hr>
<p>First Name: #first_name# Last Name: #last_name#
Date Requested:<strong> #DateFormat(date_received, "MMMM D,
YYYY")#</strong></p>
<p>Fees Paid: <input type="checkbox" name="paid"
value="#fee_paid#"></p>
<p>Amount Paid: <input type="text"
name="fee_amount" value="#fee_amount#"></p>
<p>Receipt Provided: <input type="checkbox"
name="paid" value="#receipt#"></p>
<p>Staff First Name: <input type="text"
name="staff_fname" value="#staff_fname#"></p>
<p>Staff Last Name: <input type="text"
name="staff_lname" value="#staff_lname#"></p>
<p>Staff Phone Ext.: <input type="text"
name="staff_ph_ext" value="#staff_ph_ext#"></p>
<input type="submit" name="Submit" value="Submit" />
</form>
</cfoutput>
<cfif IsDefined('form.paid')>
Paid: #paid#
<cfelse>
Paid: No method of payment selected
</cfif>
Here is the update code:
<cfquery name="change" datasource="#odbc_datasource#">
SELECT *
FROM customer_info
WHERE cust_id = #cust_id#
</cfquery>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>Update Public Rercords Request Action
Table</title>
</head>
<cfquery datasource="#odbc_datasource#">
UPDATE customer_info
SET fee_paid = '#paid#',
fee_amount = #fee_amount#,
receipt = '#paid#',
staff_lname = '#staff_lname#',
staff_fname = '#staff_fname#',
staff_ph_ext = '#staff_ph_ext#'
WHERE cust_id = #cust_id#
</cfquery>

I need to start with the box unchecked because the staff
person editing the record is checking the box to indicate a payment
was made. I modifed the code to use the cfparam tag:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "
http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US">
<cfparam name = "fee_paid" default="no">
<cfparam name = "receipt" default="no">
<cfquery name="pubrec" datasource="#odbc_datasource#">
SELECT *
FROM customer_info
WHERE cust_id = #URL.recordID#
</cfquery>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8">
<title>Edit Form for Public Records
Request</title>
</head>
<body>
<cfoutput query="pubrec">
<form action="update.cfm" method="post">
<input type="hidden" name="cust_id" value="#cust_id#">
<hr>
<p>First Name: #first_name# Last Name: #last_name#
Date Requested:<strong> #DateFormat(date_received, "MMMM D,
YYYY")#</strong></p>
<p>Fees Paid: <input type="checkbox"
name="fee_paid" value="#fee_paid#"></p>
<p>Amount Paid: <input type="text"
name="fee_amount" value="#fee_amount#"></p>
<p>Receipt Provided: <input type="checkbox"
name="receipt" value="#receipt#"></p>
<p>Staff First Name: <input type="text"
name="staff_fname" value="#staff_fname#"></p>
<p>Staff Last Name: <input type="text"
name="staff_lname" value="#staff_lname#"></p>
<p>Staff Phone Ext.: <input type="text"
name="staff_ph_ext" value="#staff_ph_ext#"></p>
<input type="submit" name="Submit" value="Submit" />
</form>
</cfoutput>
</body>
</html>
Here is the update page that send the informaiton to the
database:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "
http://www.w3.org/TR/html4/strict.dtd">
<html>
<cfquery name="change" datasource="#odbc_datasource#">
SELECT *
FROM customer_info
WHERE cust_id = #cust_id#
</cfquery>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>Update Public Rercords Request Action
Table</title>
</head>
<cfquery datasource="#odbc_datasource#">
UPDATE customer_info
SET fee_paid = '#form.fee_paid#',
fee_amount = #form.fee_amount#,
receipt = '#form.receipt#',
staff_lname = '#form.staff_lname#',
staff_fname = '#form.staff_fname#',
staff_ph_ext = '#form.staff_ph_ext#'
WHERE cust_id = #form.cust_id#
</cfquery>
<body>
<cfoutput query="change">
You <strong>edited</strong> the record for
<strong>#first_name# #last_name#</strong>.
</cfoutput>
</body>
</html>

Similar Messages

  • Unable to update or insert into Access database table using OleDB, and it doesn't return any errors.

    I'm new to VS. I have run the following code. It does not produce any error, and it does not add or update data to my Access database table.
    dbUpdate("UPDATE prgSettings SET varValue='test' WHERE varSetting='test'")   
    Function dbUpdate(ByVal _SQLupdate As String) As String
            Dim OleConn As New OleDbConnection(My.Settings.DatabaseConnectionString.ToString)
            Dim oleComm As OleDbCommand
            Dim returnValue As Object
            Dim sqlstring As String = _SQLupdate.ToString
            Try
                OleConn.Open()
                MsgBox(OleConn.State.ToString)
                oleComm = New OleDbCommand(sqlstring, OleConn)
                returnValue = oleComm.ExecuteNonQuery()
            Catch ex As Exception
                ' Error occurred while trying to execute reader
                ' send error message to console (change below line to customize error handling)
                Console.WriteLine(ex.Message)
                Return 0
            End Try
            MsgBox(returnValue)
            Return returnValue
    End Function
    Any suggestions will be appreciated.
    Thanks.

    You code looks pretty good, at a quick glance.  Maybe you can simplify things a bit.
    For Insert, please see these samples.
    http://www.java2s.com/Code/CSharp/Database-ADO.net/Insert.htm
    For Update, please see these samples.
    http://www.java2s.com/Code/CSharp/Database-ADO.net/Update.htm
    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.
    Best to keep samples here to VB.NET
    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem.

  • Problem updating data into ms access database

    Hi! I need to update a database based on user's entries. But I have a problem with the updating code. Can some1 help? Here is my whole servlet's code :
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    public class editstaff extends HttpServlet
      static Connection link;
      static Statement statement;
      static ResultSet results;
      public void doPost(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException
        response.setContentType("text/HTML");
        PrintWriter out = response.getWriter();
        out.println("<HTML>");
        out.println("<HEAD>");
        out.println("<TITLE>Edit Staff Particulars</TITLE>");
        out.println("</HEAD>");
        out.println("<BR><BR>");
        out.println("<BODY>");
        String staff = request.getParameter("name");
           try
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            link = DriverManager.getConnection("jdbc:odbc:occ","","");
          catch(ClassNotFoundException e)
            System.out.println("Sorry! Unable to load driver. Pls try again later.");
            System.exit(1);
          catch(SQLException e)
            System.out.println("Sorry! Unable to connect to the database. Pls try again later.");
            System.exit(1);
         try
            statement=link.createStatement();
            String select = "SELECT * FROM Staff WHERE Name =  '" + staff+"'";//name taken from html page
             results = statement.executeQuery(select);
            out.println("<table border=1>");
            out.println("<tr>");
            out.println("<th bgcolor=orchid>Name</th>");
            out.println("<th bgcolor=orchid>IC</th>");
            out.println("<th bgcolor=orchid>Staff_ID</th>");
            out.println("<th bgcolor=orchid>Date_Joined</th>");
            out.println("<th bgcolor=orchid>Address</th>");
            out.println("<th bgcolor=orchid>Date_of_Birth</th>");
            out.println("<th bgcolor=orchid>Designation</th>");
            out.println("<th bgcolor=orchid>Driving_License</th>");
            out.println("<th bgcolor=orchid>Mobile</th>");
            out.println("<th bgcolor=orchid>Home_Tel</th>");
            out.println("<th bgcolor=orchid>E-mail</th>");
            out.println("<th bgcolor=orchid>Section</th>");
            out.println("<th bgcolor=orchid>Department</th>");
            out.println("<th bgcolor=orchid>Course</th>");
            out.println("<th bgcolor=orchid>Date_Trained</th>");
            out.println("<th bgcolor=orchid>Recurrent_Date</th>");
            out.println("<th bgcolor=orchid>Proficiency</th>");
            while (results.next())
              out.println("<tr>");
              out.println("<td>");
              out.println(results.getString(1));
              out.println("</td>");
              out.println("<td>");
              out.println(results.getString(8));
              out.println("</td>");
              out.println("<td>");
              out.println(results.getString(9));
              out.println("</td>");
              out.println("<td>");
              out.println(results.getString(16));
              out.println("</td>");
              out.println("<td>");
              out.println(results.getString(4));
              out.println("</td>");
              out.println("<td>");
              out.println(results.getString(6));
              out.println("</td>");
              out.println("<td>");
              out.println(results.getString(10));
              out.println("</td>");
              out.println("<td>");
              out.println(results.getString(7));
              out.println("</td>");
              out.println("<td>");
              out.println(new Integer(results.getString(2)));
              out.println("</td>");
              out.println("<td>");
              out.println(new Integer(results.getString(3)));
              out.println("</td>");
              out.println("<td>");
              out.println(results.getString(5));
              out.println("</td>");
              out.println("<td>");
              out.println(results.getString(17));
              out.println("</td>");
              out.println("<td>");
              out.println(results.getString(11));
              out.println("</td>");
              out.println("<td>");
              out.println(results.getString(12));
              out.println("</td>");
              out.println("<td>");
              out.println(results.getString(13));
              out.println("</td>");
              out.println("<td>");
              out.println(results.getString(14));
              out.println("</td>");
              out.println("<td>");
              out.println(results.getString(15));
              out.println("</td>");
              out.println("</tr>");
            out.println("</table>");
            out.println("<BR><BR><BR>");
            out.println("<table border=1>");
            out.println("<tr>");
            out.println("<th>Name</th>");
            out.println("<td><input name=nam type=text id=nam></td>");
            out.println("</tr>");
            out.println("<tr>");
            out.println("<th>IC number</th>");
            out.println("<td><input name=ic type=text id=ic></td>");
            out.println("</tr>");
            out.println("<tr>");
            out.println("<th>Staff ID</th>");
            out.println("<td><input name=ID type=text id=ID></td>");
            out.println("</tr>");
            out.println("<tr>");
            out.println("<th>Date Joined</th>");
            out.println("<td>");
            out.println("<select name=jday size=1 id=jday>");
            out.println("<option>1</option>");
            out.println("<option>2</option>");
            out.println("<option>3</option>");
            out.println("<option>4</option>");
            out.println("<option>5</option>");
            out.println("<option>6</option>");
            out.println("<option>7</option>");
            out.println("<option>8</option>");
            out.println("<option>9</option>");
            out.println("<option>10</option>");
            out.println("<option>11</option>");
            out.println("<option>12</option>");
            out.println("<option>13</option>");
            out.println("<option>14</option>");
            out.println("<option>15</option>");
            out.println("<option>16</option>");
            out.println("<option>17</option>");
            out.println("<option>18</option>");
            out.println("<option>19</option>");
            out.println("<option>20</option>");
            out.println("<option>21</option>");
            out.println("<option>22</option>");
            out.println("<option>23</option>");
            out.println("<option>24</option>");
            out.println("<option>25</option>");
            out.println("<option>26</option>");
            out.println("<option>27</option>");
            out.println("<option>28</option>");
            out.println("<option>29</option>");
            out.println("<option>30</option>");
            out.println("<option>31</option>");
            out.println("</select>");
            out.println("<select name=jmth size=1 id-jmth>");
            out.println("<option>January</option>");
            out.println("<option>February</option>");
            out.println("<option>March</option>");
            out.println("<option>April</option>");
            out.println("<option>May</option>");
            out.println("<option>June</option>");
            out.println("<option>July</option>");
            out.println("<option>August</option>");
            out.println("<option>September</option>");
            out.println("<option>October</option>");
            out.println("<option>November</option>");
            out.println("<option>December</option>");
            out.println("</select>");
            out.println("<select name=jyear size=1 id=jyear");
            out.println("<option>2004</option>");
            out.println("<option>2005</option>");
            out.println("<option>2006</option>");
            out.println("<option>2007</option>");
            out.println("<option>2008</option>");
            out.println("<option>2009</option>");
            out.println("<option>2010</option>");
            out.println("<option>2011</option>");
            out.println("<option>2012</option>");
            out.println("<option>2013</option>");
            out.println("<option>2014</option>");
            out.println("</select></td></tr>");
            out.println("<tr><th>Address</th>");
            out.println("<td><textarea name=add id=add></textarea></td></tr>");
            out.println("<tr><th>Date of Birth");
            out.println("<td>");
            out.println("<select name=bday size=1 id=bday>");
            out.println("<option>1</option>");
            out.println("<option>2</option>");
            out.println("<option>3</option>");
            out.println("<option>4</option>");
            out.println("<option>5</option>");
            out.println("<option>6</option>");
            out.println("<option>7</option>");
            out.println("<option>8</option>");
            out.println("<option>9</option>");
            out.println("<option>10</option>");
            out.println("<option>11</option>");
            out.println("<option>12</option>");
            out.println("<option>13</option>");
            out.println("<option>14</option>");
            out.println("<option>15</option>");
            out.println("<option>16</option>");
            out.println("<option>17</option>");
            out.println("<option>18</option>");
            out.println("<option>19</option>");
            out.println("<option>20</option>");
            out.println("<option>21</option>");
            out.println("<option>22</option>");
            out.println("<option>23</option>");
            out.println("<option>24</option>");
            out.println("<option>25</option>");
            out.println("<option>26</option>");
            out.println("<option>27</option>");
            out.println("<option>28</option>");
            out.println("<option>29</option>");
            out.println("<option>30</option>");
            out.println("<option>31</option>");
            out.println("</select>");
            out.println("<select name=bmth size=1 id=bmth>");
            out.println("<option>January</option>");
            out.println("<option>February</option>");
            out.println("<option>March</option>");
            out.println("<option>April</option>");
            out.println("<option>May</option>");
            out.println("<option>June</option>");
            out.println("<option>July</option>");
            out.println("<option>August</option>");
            out.println("<option>September</option>");
            out.println("<option>October</option>");
            out.println("<option>November</option>");
            out.println("<option>December</option>");
            out.println("</select>");
            out.println("<select name=byear size=1 id=byear>");
            out.println("<option>1946</option>");
            out.println("<option>1947</option>");
            out.println("<option>1948</option>");
            out.println("<option>1949</option>");
            out.println("<option>1950</option>");
            out.println("<option>1951</option>");
            out.println("<option>1952</option>");
            out.println("<option>1953</option>");
            out.println("<option>1954</option>");
            out.println("<option>1955</option>");
            out.println("<option>1956</option>");
            out.println("<option>1957</option>");
            out.println("<option>1958</option>");
            out.println("<option>1959</option>");
            out.println("<option>1960</option>");
            out.println("<option>1961</option>");
            out.println("<option>1962</option>");
            out.println("<option>1963</option>");
            out.println("<option>1964</option>");
            out.println("<option>1965</option>");
            out.println("<option>1966</option>");
            out.println("<option>1967</option>");
            out.println("<option>1968</option>");
            out.println("<option>1969</option>");
            out.println("<option>1970</option>");
            out.println("<option>1980</option>");
            out.println("<option>1981</option>");
            out.println("<option>1982</option>");
            out.println("<option>1983</option>");
            out.println("<option>1984</option>");
            out.println("<option>1985</option>");
            out.println("<option>1986</option>");
            out.println("<option>1989</option>");
            out.println("<option>1990</option>");
            out.println("</select></td></tr>");
            out.println("<tr><th>Designation</th>");
            out.println("<td><input name=designation type=text id=designation></td></tr>");
            out.println("<tr><th>Driving License</th>");
            out.println("<td>");
            out.println("<select name=license size=1 multiple=multiple id=license>");
            out.println("<option>Class 3</option>");
            out.println("<option>Class 4</option>");
            out.println("<option>Class 5</option>");
            out.println("</select></td></tr>");
            out.println("<tr><th>Mobile</th>");
            out.println("<td><input name=mobile type=text id=mobile></td></tr>");
            out.println("<tr><th>Home Tel</th>");
            out.println("<td><input name=home type=text id=home></td></tr>");
            out.println("<tr><th>E-mail Address</th>");
            out.println("<td><input name=email type=text id=email</td></tr>");
            out.println("</tr><th>Section</th>");
            out.println("<td>");
            out.println("<select name=section size=1 id=section>");
            out.println("<option>Ramp</option>");
            out.println("<option>Baggage</option>");
            out.println("<option>Service Asisstants</option>");
            out.println("<option>Flight Coordinators</option>");
            out.println("</select></td>");
            out.println("<th>Department</th>");
            out.println("<td>");
            out.println("<select name=dept size=1 id=dept>");
            out.println("<option>PAX</option>");
            out.println("<option>Ramp</option>");
            out.println("<option>Cargo</option>");
            out.println("</select></td>");
            out.println("<th>Course</th>");
            out.println("<td>");
            out.println("<select name=course size=1 multiple=multiple id=course>");
            out.println("<option>Ramp Safety</option>");
            out.println("<option>Dangerous Goods</option>");
            out.println("<option>Security Training</option>");
            out.println("</select></td></tr>");
            out.println("<tr><th>Date Trained</th>");
            out.println("<td>");
            out.println("<select name=tday size=1 id=tday>");
            out.println("<option>1</option>");
            out.println("<option>2</option>");
            out.println("<option>3</option>");
            out.println("<option>4</option>");
            out.println("<option>5</option>");
            out.println("<option>6</option>");
            out.println("<option>7</option>");
            out.println("<option>8</option>");
            out.println("<option>9</option>");
            out.println("<option>10</option>");
            out.println("<option>11</option>");
            out.println("<option>12</option>");
            out.println("<option>13</option>");
            out.println("<option>14</option>");
            out.println("<option>15</option>");
            out.println("<option>16</option>");
            out.println("<option>17</option>");
            out.println("<option>18</option>");
            out.println("<option>19</option>");
            out.println("<option>20</option>");
            out.println("<option>21</option>");
            out.println("<option>22</option>");
            out.println("<option>23</option>");
            out.println("<option>24</option>");
            out.println("<option>25</option>");
            out.println("<option>26</option>");
            out.println("<option>27</option>");
            out.println("<option>28</option>");
            out.println("<option>29</option>");
            out.println("<option>30</option>");
            out.println("<option>31</option>");
            out.println("</select>");
            out.println("<select name=tmth size=1 id=tmth>");
            out.println("<option>January</option>");
            out.println("<option>February</option>");
            out.println("<option>March</option>");
            out.println("<option>April</option>");
            out.println("<option>May</option>");
            out.println("<option>June</option>");
            out.println("<option>July</option>");
            out.println("<option>August</option>");
            out.println("<option>September</option>");
            out.println("<option>October</option>");
            out.println("<option>November</option>");
            out.println("<option>December</option>");
            out.println("</select>");
            out.println("<select name=tyear size=1 id=tyear>");
            out.println("<option>2005</option>");
            out.println("<option>2006</option>");
            out.println("<option>2007</option>");
            out.println("<option>2008</option>");
            out.println("<option>2009</option>");
            out.println("<option>2010</option>");
            out.println("<option>2011</option>");
            out.println("<option>2012</option>");
            out.println("<option>2013</option>");
            out.println("<option>2014</option>");
            out.println("<option>2015</option>");
            out.println("</select></td></tr>");
            out.println("<tr><th>Recurrent Date</th>");
            out.println("<td>");
            out.println("<select name=rday size=1 id=rday>");
            out.println("<option>1</option>");
            out.println("<option>2</option>");
            out.println("<option>3</option>");
            out.println("<option>4</option>");
            out.println("<option>5</option>");
            out.println("<option>6</option>");
            out.println("<option>7</option>");
            out.println("<option>8</option>");
            out.println("<option>9</option>");
            out.println("<option>10</option>");
            out.println("<option>11</option>");
            out.println("<option>12</option>");
            out.println("<option>13</option>");
            out.println("<option>14</option>");
            out.println("<option>15</option>");
            out.println("<option>16</option>");
            out.println("<option>17</option>");
            out.println("<option>18</option>");
            out.println("<option>19</option>");
            out.println("<option>20</option>");
            out.println("<option>21</option>");
            out.println("<option>22</option>");
            out.println("<option>23</option>");
            out.println("<option>24</option>");
            out.println("<option>25</option>");
            out.println("<option>26</option>");
            out.println("<option>27</option>");
            out.println("<option>28</option>");
            out.println("<option>29</option>");
            out.println("<option>30</option>");
            out.println("<option>31</option>");
            out.println("</select>");
            out.println("<select name=rmth size=1 id=rmth>");
            out.println("<option>January</option>");
            out.println("<option>February</option>");
            out.println("<option>March</option>");
            out.println("<option>April</option>");
            out.println("<option>May</option>");
            out.println("<option>June</option>");
            out.println("<option>July</option>");
            out.println("<option>August</option>");
            out.println("<option>September</option>");
            out.println("<option>October</option>");
            out.println("<option>November</option>");
            out.println("<option>December</option>");
            out.println("</select>");
            out.println("<select name=ryear size=1 id=ryear>");
            out.println("<option>2005</option>");
            out.println("<option>2006</option>");
            out.println("<option>2007</option>");
            out.println("<option>2008</option>");
            out.println("<option>2009</option>");
            out.println("<option>2010</option>");
            out.println("<option>2011</option>");
            out.println("<option>2012</option>");
            out.println("<option>2013</option>");
            out.println("<option>2014</option>");
            out.println("<option>2015</option>");
            out.println("</select></td></tr>");   
            out.println("<tr><th>Proficiency</th>");
            out.println("<td><input name=prof type=text id=prof</td></tr>");
            out.println("</table>");
            out.println("<p align=right>");
      out.println("<input type=submit name=submit value=Submit>");
      out.println("<input type=reset name=reset value=Reset>");
      out.println("</p>");
            String nam = request.getParameter("nam");
            String ic = request.getParameter("IC");
            String jday = request.getParameter("jday");
            String jmth = request.getParameter("jmth");
            String jyear = request.getParameter("jyear");
            String mobile = request.getParameter("mobile");
            String home = request.getParameter("home");
            String add = request.getParameter("add");
            String email = request.getParameter("email");
            String day = request.getParameter("day");
            String mth = request.getParameter("mth");
            String year = request.getParameter("year");
            String designation = request.getParameter("designation");
            String dept = request.getParameter("dept");
            String ID = request.getParameter("ID");
            String license = request.getParameter("license");
            String course = request.getParameter("course");
            String tday = request.getParameter("tday");
            String tmth = request.getParameter("tmth");
            String tyear = request.getParameter("tyear");
            String rday = request.getParameter("rday");
            String rmth = request.getParameter("rmth");
            String ryear = request.getParameter("ryear");
            String prof = request.getParameter("prof");
            String sect = request.getParameter("job");
        String dob = ""+day+"-"+mth+"-"+year+"";
        String train = ""+tday+"-"+tmth+"-"+tyear+"";
        String date = ""+jday+"-"+jmth+"-"+jyear+"";
        String recurrent = ""+rday+"-"+rmth+"-"+ryear+"";
            String name = request.getParameter("name");
            String change = "UPDATE Staff  SET Name='"+nam+"',Mobile='"+mobile+"',Home='"+home+"',"
                                    +"Address='"+add+"',E-mail='"+email+"',DOB='"+dob+"',Driving License='"+license+"',IC='"+ic+"',"
                                    +"Staff ID='"+ID+"',Designation='"+designation+"',Department='"+dept+"',Course='"+course+"',"
                                    +"Date Trained='"+train+"',Recurrent Date='"+recurrent+"',Proficiency='"+prof+"',"
                                    +"Date Joined='"+date+"',Section'"+sect+"' WHERE Name='"+name+"'";//name taken from html page
            results = statement.executeQuery(change);
          catch(SQLException e)
            System.out.println("Sorry! Unable to update data. Pls try again later.");
            e.printStackTrace();
            System.exit(1);
          try
              out.println("<br />");
              out.println("</font></BODY>");
              out.println("</HTML>");
              out.flush();
              link.close();
          catch(SQLException e)
            System.out.println("Sorry! Unable to execute query. Pls try again later.");
            e.printStackTrace();
            System.exit(1);
      

    hi,
    For Select Query there is Method executeQuery();
    For insert, update, delete executeUpdate() is use
    so try with executeUpdate()
    and it will return how much row are updated.

  • Adobe LiveCycle ES4 add new and update Access Database, Non-Null failure

    I am using adobe livecycle es4 and I am trying to add a new record and then update it to an Access database. However, when i press update the error tells me that i cannot have Null values and it displays a check box field name. How can i allow a null value for a check box? Because when my form is used, not all of the check boxes will be checked

    You can use the resolveNode function that can catch the null value of your check box component.
    Exemple:
    if (this.resolveNode("NameCheckBox").rawValue == null)
    //Do Something

  • Uk date format issue with ASP and Access Database

    I have an Asp form which updates records in an Access
    database. Problem is
    that the date format in the database record is dd/mm/yyyy
    (UK), when
    the record is displayed on the form it is mm/dd/yyyy(US)
    which after I
    update the record in the database the date has changed to the
    new format.
    I have tried everything I can to change the format but to no
    avail...anyone any ideas how I can resolve this issue?
    Thanks
    Steve

    stevo.s wrote:
    > Hi
    >
    > I have tried changing the format on the date field on
    the server behaviours
    > panelto ddmmyyy. Also have tried to set the form field
    format to ddmmyy. I have
    > also tried to use a function I got from a posting
    somehwere on the net to no
    > avail. <%function ddmmyyyy(varDate)
    > ddmmyyyy = Day(DateValue(varDate)) & "/" &
    Month(DateValue(varDate))
    > & "/" & Year(DateValue(varDate))
    > end function
    >
    > I believe that this is a recognised issue with
    Dreamweaver and Access but
    > can't seem to grasp the work around! Problem being I am
    teaching myself through
    > books and internet articles and can be weeks at a time
    without being able to
    > look at the issue..each time I come back to it it is
    like starting all over
    > again! I was hoping that somewhere out there there is a
    simple solution the
    > issue perhaps a date picker with the built in
    functionality to address the
    > issue...I am keen to understand how to deal with the
    issue rather than just
    > change my database date field to fudge the problem as I
    am in the UK and when I
    > eventually start to use the application I would like
    there to be some
    > consistency with dates and that users are familiar with
    the format.
    >
    > Any help gratefully received!
    Its not Dreamweaver, or Access, its your servers locale, its
    set to US
    format, not the UK.
    On your page at the top use:
    <% Session.LCID = 2057 %>
    This will force the page into using UK formatted dates. Use
    it on any
    page that needs to format the page correctly.
    Dooza
    Posting Guidelines
    http://www.adobe.com/support/forums/guidelines.html
    How To Ask Smart Questions
    http://www.catb.org/esr/faqs/smart-questions.html

  • Update a field in an access database via TestStand

    I want to read a value from a numeric field in an MS Access database, increment that value by one, and then update the database record that I got the value from with the new value. I am able to execute an Open Database step, execute a Open SQL Statement step with a SELECT query, execute a "Get" operation in a Data Operation step to get the value into a TestStand variable, and increment the value, but I'm at a loss for how to update the databse record with the incremented value.
    I tried to execute another Open SQL Statement step with an UPDATE statement, but I get a "Specified value does not have the expected type." error. The TestStand variable type is a number, and the Data Type of the database field is Number. I've tried using long integer, double, and decimal as field sizes, but they all give me the same error.
    I also tried to execute a "Set" operation with another Data Operation step against the original Statement Handle. When I do this, the Data Operation runs without error, but when I run a Close SQL Statement step against the statement handle I get an "ADODB.Recordset: Operation is not allowed in this context." error.
    Any help would be appreciated.

    Scripter -
    When you try to do a Set and Put, it is always good to explicitly set the statement's cursor type to something other than forward only, like keyset, and the lock type to something other than read-only. See if that helps...
    Scott Richardson
    National Instruments

  • How to detect concurrent updates from MS Access database

    Hi...
    I would like to know how can LV detect the MS Access database if there is any updates data from others application such as VB6 through the same database.. I do not want the LV to check from the database so oftenly. It will only do the checking / refreshing of data when there is a new data updated by other software (like VB) into the same database. THANKS!!......

    222,
    It sounds like you want MS Access to send an event or callback to your Labview program whenever it receives an update.  I'm definitely no Access expert, and I'm not sure if the program can generate events like that (I've done some searches at Microsoft.com, with no luck so far).  I would suggest going to Microsoft's website to either contact technical support with the question, or post to their forums.  The first step would be figuring out if it's possible to generate such an event, and if so, we can go from there.  If not, the polling method might be the only option.  Here are some links that will help get you started:
    Microsoft Access Home
    Microsoft Office Access 2003 Help and Support
    -Justin

  • How to update single row of ms access database

    Hi All,
    can somebody tell me how can i edit/update a single row of ms access database?
    let say i want to edit the first row of the figure in the left. What i want is when i click in the row, it will pop up a window where i can edit the fields content. or may be is it possible to add a column with "edit" text which link to the appropriate row. so when i click the "edit" it will open the edit window.
    Thank you

    If you use a multi-column listbox indicator there is a "double-click" event that you can capture with an event structure. The event, when fired, returns the row that the user double-clicked. Use that parameter to fetch/modify the data as needed. Remember that to update the data in the database the table containing the data must have a primary key - or at lease something you can use to uniquely identify the rows.
    Remember that in a database, there is no such thing as "the first row"; you have to explicitly identify which row you wish to modify.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Update Access database via OleDB from DataGridView

    I have been scouring these forums and the internet in general as well as doing a lot of reading, all to no avail.  I can not seem to successfully update the Access database from an edited DataGridView.  I am trying to use Stored Procedures that
    are in the Access database and work fine therein.  The DGV is filled in properly.  I have tried an ever-increasing number of variants to update the database (Private Sub BtnUpdate...)  without success.  I'd really, really appreciate some
    guidance here.
    Here is my code thus far:
    Public Class Form1
        Dim con As OleDbConnection    
        Dim cmd As OleDbCommand
        Dim da As OleDbDataAdapter
        Dim ds As DataSet
        Dim ProviderConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
        Dim TargetList As String = "C:\Users\Administrator\Documents\Visual Studio 2010\Projects\Development5\Test.mdb"
        Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            'establish a connection to the database
            con = New OleDbConnection(ProviderConnectionString & TargetList)
            con.Open()
            'define the command to be used
            cmd = New OleDbCommand
            cmd.Connection = con
            cmd.CommandType = CommandType.StoredProcedure
            cmd.CommandText = "ListAllTargets"
             'create the data adapter based on the command
            da = New OleDbDataAdapter(cmd)
            'fill the data set based on the command
            ds = New DataSet
            da.Fill(ds, "AllTargets")
            'bind and load dgvTargets with the data
            dgvTargetList.DataSource = ds.Tables("AllTargets")  ' Binding to dgvtargetlist
         End Sub
        Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click
             da.UpdateCommand = New OleDbCommand("UPDATE TargetList SET;", con)
            Validate()
            da.Update(ds.Tables("AllTargets"))
            Me.ds.AcceptChanges()
        End Sub
    End Class

    Hi John,
    Welcome to MSDN forums!
    Cor pointed you to the right direction. An OleDBCommandbuilder object is required, which can be used to automatically
    generate DeleteCommand, UpdateCommand and InsertCommand for DataAdapter object.
    Here is detailed walkthrough: How to update
    (Insert/Update/Delete) data back into MS Access database from DataGridView.
    1) New a WinForms project, drag&drop DataGridView1 and Button1 onto
    Form1.
    2) Add database file test.mdb to project via: Data menu -> Add New Data Source
    Wizard ... then you can use ralative path to this database file in code
    3) Select/click
    your database file test.mdb in Solution Explorer
    -> Properties Pane
    -> change the "copy to ouput directory" to "copy
    if newer"
    4) Code sample
    Imports System.Data.OleDb
    Public
    Class Form1
    Dim myDA As OleDbDataAdapter
    Dim myDataSet As DataSet
    Private Sub Form1_Load(ByVal sender
    As System.Object, ByVal e
    As System.EventArgs) Handles
    MyBase.Load
    Dim con As OleDbConnection =
    New OleDbConnection("Provider=Microsoft.jet.oledb.4.0;data source=|DataDirectory|\test.mdb")  ' Use relative path to database file
    Dim cmd As OleDbCommand =
    New OleDbCommand("SELECT * FROM Table1", con)
    con.Open()
    myDA = New OleDbDataAdapter(cmd)
    'Here one CommandBuilder object is required.
          'It will automatically generate DeleteCommand,UpdateCommand and InsertCommand for DataAdapter object  
    Dim builder As OleDbCommandBuilder =
    New OleDbCommandBuilder(myDA)
    myDataSet = New DataSet()
    myDA.Fill(myDataSet, "MyTable")
    DataGridView1.DataSource = myDataSet.Tables("MyTable").DefaultView
    con.Close()
    con = Nothing
    End Sub
    ' Save data back into database  
    Private Sub Button1_Click(ByVal sender
    As System.Object, ByVal e
    As System.EventArgs) Handles Button1.Click
    Me.Validate()
    Me.myDA.Update(Me.myDataSet.Tables("MyTable"))
    Me.myDataSet.AcceptChanges()
    End Sub
    End
    Class
    Best regards,
    Martin Xie
    MSDN Subscriber
    Support in Forum
    If you have any feedback on our support, please contact
    [email protected]
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.

  • UPDATE VALUE IN ACCESS DATABASE-CONNECTIVITY DATABASE?

    Hi to all labviewers,
    I'm trying to update some values in my access database with sql and labview connectivity toolset but i got
    an error, what is the problem whit my code?
    note: when i try to update one colum it's work fine.
    regard's
    eyal.
    Attachments:
    UPDATE_ACCESS.JPG ‏79 KB

    Hi,
    I'm not sure if you can use comma's to seperate criteria. Thy this:
    WHERE criteriuma='something' AND criteriumb='something else'
    Regards,
    Wiebe.
    "Discussion Forums" <[email protected]> wrote in message news:[email protected]..
    Hi to all labviewers,
    I'm trying to update some values in my access database with sql and labview connectivity toolset but i got
    an error, what is the problem whit my code?
    note: when i try to update one colum it's work fine.
    &nbsp;
    regard's
    eyal.
    UPDATE_ACCESS.JPG:
    http://forums.ni.com/attachments/ni/170/152737/1/UPDATE_ACCESS.JPG

  • How to get AW7 to update an Access database...

    I have created a simple Access database file to be used for student records, and need to figure out how to set up AW7 to write data to and from the file. I have scoured the internet, blogs, forums and such, but haven't found anything helpful or straightforward, and most info is for old versions...so does anyone know of a resource, link, or has experience with this?  Some sample code for my calc icons to use as a guide? If anyone has experience with this ODBC MIcrosoft Access communication I would greatly appreciate some guidance. Thanks to everyone in advance, I really appreciate it!!

    Hey Steve-
    I would like your opinion/thoughts on the use of AW- I know that AW has not
    been updated for awhile, and won't ever again, so it wouldn't be a good idea
    to start now, and I would normally agree. But I still believe AW by itself,
    as a standalone program to develop courseware, is still a great tool.
    (Wouldn't bother learning it from scratch, but I've used it before.) It
    seems to me that AW is not practical in this day and age, because the AW Web
    Player is outdated, and AW web publishing was created around IE3 probably,
    and LMS's are updated every day...my point is that AW seems to be outdated
    when it comes to delivery over the web.
    To the point- I may still be tasked with developing some courseware solely
    for a stand-alone, independent classroom, completely isolated from the web,
    don't even care if IE or Mozilla is installed on any computer. (So no web
    packaging, just as .exe or .a7r) Even have full control over whatever
    version of Windows is used. So would you still consider AW? I still am,
    obviously, I have worked with Captivate and it just seems so simple and
    basic compared to the capability AW still has.
    To the point again- so taking the web environment out of the equation, *have
    you encountered any issues using AW in 2011 that are show-stoppers?* Maybe a
    strictly OS issue with Windows 7?
    I would be very interested in any brief comments or thoughts you have on
    what I have said, you have been a huge help to me already and I really
    appreciate your time. Thanks!!
    Terry

  • Update MS Access Database table using ABAP

    Hi All,
    I have a requirement wherein I have to update the existing records in MS Access database using ABAP Code. Can someone provide sample code through which I can achieve this. Thanks!!!
    Regards,
    Nitish Reddy.
    Edited by: Nitish Cherukupally on Mar 30, 2009 4:02 PM

    hi,
    please refer to this link
    http://learningabap.wordpress.com/2007/04/11/get-data-from-ms-access-into-internal-table/
    http://abapcode.blogspot.com/2007/05/get-data-from-ms-access-into-internal.html
    http://abapcode.blogspot.com/2007/06/sample-program-to-upload-excel-document.html
    MS Access Database using ABAP Program
    thanks

  • Updating a Access Database via a Bean

    I�m having a problem using a java bean to update the contents of a database. I receive the error message:
    Cannot find a method to read property 'firstname' in a bean of type 'myBeans.UpdateGuestBean'
    I have an html form embedded in a jsp page as follows:
    <FORM NAME="members" ACTION="members.jsp"
          METHOD="POST">
        <TABLE BORDER="1" WIDTH="50%" ALIGN="center" BGCOLOR="lightgreen" CELLPADDING="2">
        <TR>
             <TD WIDTH="25%"><B>Firstname:</B></TD>
             <TD WIDTH="25%"><INPUT TYPE="text" SIZE="25" NAME="firstname" VALUE="<%= firstname %>"></TD>
        </TR>
        <TR>
             <TD><B>LastName:</B></TD>
             <TD><INPUT TYPE="text" NAME="surname" SIZE="25" VALUE="<%= surname %>"></TD>
        </TR>
        <TR>
             <TD><B>Email:</B></TD>
             <TD><INPUT TYPE="text" NAME="email" SIZE="25" VALUE="<%= email %>"></TD>
        </TR>
             <TD COLSPAN="2" ALIGN="right" WIDTH="50%"><INPUT TYPE="submit" VALUE="Update"></TD>
        </TR>I then call on members.jsp
    <%@ page language="java" contentType="text/html" errorPage="errorpage.jsp" %>
    <HTML>
    <HEAD><TITLE>Order Form</TITLE></HEAD>
    <BODY>
    import java.sql.*;
    <jsp:useBean id="members" class="myBeans.UpdateGuestBean" />
    <jsp:setProperty name="members" property="*"/>
    <ul>
    <li>first: <jsp:getProperty name="members" property="firstname" />
    <li>secondname: <jsp:getProperty name="members" property="surname" />
    <li>email: <jsp:getProperty name="members" property="email" />
    </ul>
    <% members.updateDatabase(); %>
    <jsp:forward page="confirmation.jsp" />
    </BODY>
    </HTML>Finally calling my java bean:
    package myBeans;
    import java.sql.*;
    class UpdateGuestBean
      //declare variables
      private String firstname;
      private String surname;
      private String email;
      //set methods
      public void setfirstname(String inputFirstname)
        this.firstname=inputFirstname;
      public void setsurname(String inputSurname)
        this.surname=inputSurname;
      public void setemail(String inputEmail)
        this.email=inputEmail;
      public void makeChanges(String email)
        try
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
          Connection conn = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=C:/Tomcat/jakarta-tomcat-4.1.31/webapps/ROOT/MyDB.mdb","","");
          Statement statement = conn.createStatement();
          String sql = "UPDATE members SET MyDB.Firstname='" + this.firstname + "' WHERE Username ='" + email + "';";
          statement.executeUpdate(sql);
          if (statement != null) statement.close();
          if (conn != null) conn.close();
        catch(Exception e)
          System.out.println("My error: " + e);
    }Help! I�ve run out of ideas. For a reminder, the error message is
    Cannot find a method to read property 'firstname' in a bean of type 'myBeans.UpdateGuestBean'
    Thanks in advance.

    Thanks for that. I put the getter methods in and it resolved that error message, however now I get a new error message:
    cannot resolve symbol
    symbol: method updateDatabase ()
    location: class myBeans.UpdateGuestBean
    members.updateDatabase();
    ^
    Any ideas? I think its referring to the jsp file members.jsp:
    <%@ page language="java" contentType="text/html" errorPage="errorpage.jsp" %>
    <HTML>
    <HEAD><TITLE>Order Form</TITLE></HEAD>
    <BODY>
    import java.sql.*;
    <jsp:useBean id="members" class="myBeans.UpdateGuestBean" />
    <jsp:setProperty name="members" property="*"/>
    <ul>
    <li>first: <jsp:getProperty name="members" property="firstname" />
    <li>secondname: <jsp:getProperty name="members" property="surname" />
    <li>email: <jsp:getProperty name="members" property="email" />
    </ul>
    <% members.updateDatabase(); %>
    <jsp:forward page="confirmation.jsp" />
    </BODY>
    </HTML>

  • Connect to a remote MS Access database using RmiJdbc

    Hello,
    I want to access a remote MS Access database from oracle stored procedures.
    Does anyone know how i can load the RmiJdbc driver using the loadjava command or with any other way.
    Because when i try to load RmiJdbc.zip using the loadjava command I am getting the error:
    ORA-29533:attempt to overwrite class or resource string while defining or compiling scott.TestClient
    this error is occured for multiple files...
    I don't know how to delete this classes.
    Because this error occured and the first time i tried to load Rmijdbc driver.
    and when i use the dropjava command to drop it,and then load it again the same error occures.
    Can anyone help me how to load this driver?
    Please answer because i need it as soon as possible.
    Thanks

    Hi,
    try this.
    String s = "UPDATE AGENT SET afname='test',alname='u',city='d',AGENT.[percent]=1 WHERE aid=23";
    -------->AGENT.[percent]

  • How to Protect your Custom Access Database Product - so that you can sell & distribute it?

    I'm looking for an update on this topic as I have been away from Access for a couple of years and have not kept up with the latest.
    Hopefully they have made it easier to design, develop, sell and distribute custom database solutions. So here goes...
    Question A:
    If one develops a custom database product with Access 2013 what is the current best way to...
    1 - Prevent it from being (too easily) copied
    2 - Prevent it from being (too easily) reverse engineered
    3 - Prividing a time limited free demo copy?
    4 - Providing a demo copy with limited functionality... like limiting the number of records in an important table, or whatever?
    5 - What have I left out of this list that should be considered for protecting ones investment in the development of the product? (other than copyright, of course.)
    Question B:
    What is the latest on being able to migrate an Access database to the cloud?
    1 - Entirely online
    2 - Part in the cloud and part on the users machine
    3 - And what about all that VBA code - is there no way to make that work in the cloud and/or on a web server... or does it all have to be tossed and all the coding redone?
    Question C:
    What are other alternatives solutions for selling your custom database application while protecting all your investment in developing it?
    1 - Write the front end in C++  (so that it is fully compiled) and the back end in ASP with MS SQL Server? (or alternative server side solutions)
    2 - Write the whole thing as a server side solution with browser interface?
    3 - Or what?
    Thanks for any help.

    Hi Fran_3,
    >>What is the latest on being able to migrate an Access database to the cloud?
    In my option, the Access Web app would be a better choise.
    Regards,
    Tony
    Help each other

Maybe you are looking for