Advertisement
7_2009-2012 Databases/ JDBC #226797

A Java Server Insertion to DB

This is a simple code that add a UserName and PassWord to a table "Access" through ODC connection. 1.First I created the HTML form with two fields with an action that sends the data to the "AddUserDbd.jsp" ... 2. "AddUserDbd.jsp" initialize the connection and two functions "OpenConnection" and "InsertUsers(,,)" 3. getParameter is used to read the fields from ny HTML form e.g Name = request.getParameter("userName"); Password = request.getParameter("passWord"); and both Paramenters are then iserted into the function InsertUsers(Name,Password); see the code to understand .. to be able to run this code please read about tomcat on sun's website and follow instruction carefully ....

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
Upload
<p>In C it is possible to create a function that will accept a variable amount of arguments. The parameter must have at least one defined parameter followed by an ellipsis, three periods “…”. For example printf()’s prototype has one defined parameter and an ellipses:</p>
<p>printf(char *, …);</p>
<p>However, just an ellipses is not allowed:</p>
<p>function(…);</p>
<p>You may use as many defined arguments as you would like, but the ellipses must be the last, for example:</p>
<p>function(int, char *, float, …);</p>
<p>There are several functions used to access the arguments passed through the ellipses, to use them you must include cstdarg.</p>
<p>	#include<cstdarg></p>
<p>Note that cstdarg is not a header file, but it is included like one.</p>
<p>In the function that is receiving the variable arguments you must have a va_list variable that is used by the functions that retrieve the arguments passed through the ellipses. The function va_start() will setup the va_list variable so you can retrieve arguments. The va_start() function takes two arguments. The first is the va_list variable, and the second is the argument that immediately precedes the variable arguments.</p>
<p>The function used to actually retrieve the arguments is va_arg(). This function also takes two arguments. The first is a va_list variable that has previously established with va_start(), and the second is the type of variable you want to retrieve. For the type you use any variable type; for example int or char. The va_arg() function will return the value of the variable you are retrieving.</p>
<p>When you are done you must call va_end() to clean up the va_list variable. It only takes a va_list variable.</p>
<p>Here is an example of all that put together:</p>
 
<p>#include&lt;cstarg&gt;</p>
<p>#include&lt;stdio.h&gt;</p>
<p>void VarArg(int Num, …);</p>
<p>void main(void)</p>
<p>{</p>
<p>	VarArg(4, 1, 2, 3, 4);</p>
<p>	VarArg(3, 6, 7, 8);</p>
<p>	return;</p>
<p>}</p>
<p>void VarArg(int Num, …)</p>
<p>{</p>
<p>	va_list VList;</p>
<p>	va_start(VList, Num);</p>
	
<p>	printf(“\nPassed parameters: “);</p>
<p>	for (; Num > 0; Num--)</p>
<p>{</p>
<p>	printf(“ %d,”, va_arg(VList, int);</p>
<p>}</p>
<p>return;</p>
<p>}</p>
Original Comments (3)
Recovered from Wayback Machine