pittsfield-jew

The first post says it all Shalom, This is the home of the Pittsfield Jew. Sure its neat to read about Jews in Brooklyn who are very observant but how about a not so observant Jew who lives in the Mid West?

Friday, July 18, 2008

Basketball fixed

Yeah the basketball hoop is fixed. Two engineers helped. They thought outside the box. Right about now Jonny is thinking about kicking off the weekend. He is turning 40 this month too. Not to give away the exact date. Right now he is trying something out in access ODBC as usual and the database isn't cooperating. Early he tried to make an ASP.NET program to look at the Oracle table and let a person change their password. The program sucks. The language sucks. This query has the whole pc locked up. Jonny rode his bike to work and for 16 minutes talked to Wendell. They sent money and that will help pay for the big golf outing this next weekend.

Below is the aspx, nothing unusual here. blogger won't take it so out it goes.





LT %@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" % RT

LT !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" RT

LT html xmlns="http://www.w3.org/1999/xhtml" RT
LT head runat="server" RT
LT title RTUntitled PageLT /title RT
LT /head RT
LT body RT
LT form id="form1" runat="server" RT
LT div RT
LT table style="width: 434px; height: 199px" RT
LT tr RT
LT td style="width: 238px" RT
LT asp:Label ID="Label1" runat="server" Text="user name" RTLT /asp:Label RTLT /td RT
LT td RT
LT /td RT
LT /tr RT
LT tr RT
LT td style="width: 238px; height: 5px;" RT
LT /td RT
LT td style="height: 5px" RT
LT /td RT
LT /tr RT
LT tr RT
LT td style="width: 238px" RT
LT asp:TextBox ID="TextBox1" runat="server" RTLT /asp:TextBox RTLT /td RT
LT td RT
LT /td RT
LT /tr RT
LT tr RT
LT td style="width: 238px; height: 50px;" RT
LT /td RT
LT td style="height: 50px" RT
LT /td RT
LT /tr RT
LT tr RT
LT td style="width: 238px" RT
LT asp:Label ID="Label2" runat="server" Text="password" RTLT /asp:Label RTLT /td RT
LT td RT
LT /td RT
LT /tr RT
LT tr RT
LT td style="width: 238px; height: 7px;" RT
LT /td RT
LT td style="height: 7px" RT
LT /td RT
LT /tr RT
LT tr RT
LT td style="width: 238px" RT
LT asp:TextBox ID="TextBox2" runat="server" TextMode="Password" RTLT /asp:TextBox RTLT /td RT
LT td RT
LT /td RT
LT /tr RT
LT tr RT
LT td style="width: 238px; height: 48px;" RT
LT /td RT
LT td style="height: 48px" RT
LT /td RT
LT /tr RT
LT tr RT
LT td style="width: 238px" RT
LT asp:Button ID="Button1" runat="server" Text="Connect" OnClick="Button1_Click" / RTLT /td RT
LT td RT
LT /td RT
LT /tr RT
LT tr RT
LT td style="width: 238px; height: 48px;" RT
LT /td RT
LT td style="height: 48px" RT
LT /td RT
LT /tr RT
LT tr RT
LT td style="width: 238px" RT
LT asp:Label ID="Label3" runat="server" Text="new password" Visible="False" RTLT /asp:Label RTLT /td RT
LT td RT
LT /td RT
LT /tr RT
LT tr RT
LT td style="width: 238px" RT
LT /td RT
LT td RT
LT /td RT
LT /tr RT
LT tr RT
LT td style="width: 238px" RT
LT asp:TextBox ID="TextBox3" runat="server" Visible="False" TextMode="Password" RTLT /asp:TextBox RTLT /td RT
LT td RT
LT asp:Button ID="Button2" runat="server" Text="Change" OnClick="Button2_Click" Visible="False" / RTLT /td RT
LT /tr RT
LT tr RT
LT td style="width: 238px" RT
LT asp:Label ID="Label4" runat="server" Text="success!" Visible="False" RTLT /asp:Label RTLT /td RT
LT td RT
LT /td RT
LT /tr RT
LT /table RT
LT /div RT
LT /form RT
LT /body RT
LT /html RT


Below that is the aspx.cs c# of course.


/* Written by Jonny Lee Miller
Written on July 18, 2008
Allows user to change Oracle password via a web form
*/
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OracleClient;

public partial class _Default : System.Web.UI.Page
{
OracleConnection con;
OracleCommand command;
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Focus();
/* in other words if this really is the first time
* calling this web page, initialize everything */
if (Session["command"] == null)
{
command = new OracleCommand();
con = new OracleConnection();
Session["con"] = con;
Session["command"] = command;
}
else
{
command = (OracleCommand)Session["command"];
con = (OracleConnection)Session["con"];
}
}
protected void Button1_Click(object sender, EventArgs e)
{
con.ConnectionString = "User Id=" + TextBox1.Text +
";Password=" + TextBox2.Text + ";Data Source=crdwmsis;";
try
{
con.Open();
command.Connection = con;
TextBox3.Visible = true;
Label3.Visible = true;
Button2.Visible = true;
TextBox3.Focus();
}
catch
{
TextBox2.Focus();
}
}
protected void Button2_Click(object sender, EventArgs e)
{
command.CommandText = "ALTER USER " + TextBox1.Text +
" IDENTIFIED BY " + TextBox3.Text;
try
{
command.ExecuteNonQuery();
Label4.Visible = true;
}
catch
{
Label4.Text = "Failure to change password, sorry";
Label4.Visible = true;
}
}
}

Now Jonny's hands are shaking too much. Not enough food and too much caffeine.

0 Comments:

Post a Comment

<< Home

 
Listed on BlogShares