Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Newbie Question

Reply
Thread Tools

Newbie Question

 
 
Mike
Guest
Posts: n/a
 
      09-14-2004
I am new to Java. I have been trying some simple JSP connections to a
MS-SQL table. I wrote one that reads from a test database and table
that I set up and works. I am now trying to write a simple one to use
a form to fill in information and have this post to the table. This
one I can't get to work and I don't know what I am doing wrong. I am
just learning..
Thanks in advance

Here is my jsp:

<%@ page import = "java.sql.*" %>
<HTML>
<HEAD>
<%String Name;
String Email;%>
<TITLE> A JSP file for testing MSSQL database update</TITLE></HEAD>
<BODY>
<jsp:useBean id='clock' scope='page' class='dates.JspCalendar'
type="dates.JspCalendar" />
<form action="" method=POST>
Your Name*<input type="text" name="Name"><BR>**
Your Email <input type="text" name="Email"><BR>**
<input type="hidden" name="Posted" value="1">
<input type="submit" value="Sign Up">
</form>
<%
Class.forName( "com.microsoft.jdbc.sqlserver.SQLServerDriver" );
Connection con=java.sql.DriverManager.getConnection
("jdbc:microsoft:sqlserver://XXX:1433;User=XXX;Password=XXX");
String sql;
sql = "INSERT INTO XXX.dbo.MyUsers(Name, email) VALUES (?,?)";
PreparedStatement ps = con.prepareStatement(sql,Name,Email);
ps.executeUpdate();
%>
</BODY>
</HTML>
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VONAGE Newbie w/newbie question New_kid@nowhere.new VOIP 0 08-11-2007 01:40 PM
another newbie question from another newbie.... Lee UK VOIP 4 05-17-2005 04:10 PM
newbie: cisco vlan newbie question No Spam Cisco 3 06-07-2004 10:02 AM
dumb newbie question (or newbie dumb question) Jerry C. Perl Misc 8 11-23-2003 04:11 AM
Newbie! I'm a newbie! What's wrong with this program? Id0x Python 4 07-20-2003 11:40 PM



Advertisments