[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] i [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Integer[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Button1_Click([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Object, [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2] Button1.Click[/SIZE]
[SIZE=2][COLOR=#008000]'for connecting to Josh's server:[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] oradb [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][SIZE=2] = "Data Source=(DESCRIPTION=(ADDRESS_LIST=" _[/SIZE]
[SIZE=2]+ "(ADDRESS=(PROTOCOL=TCP)(HOST=...)(PORT=1521)))" _[/SIZE]
[SIZE=2]+ "(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=XE)));" _[/SIZE]
[SIZE=2]+ "User Id=vb;Password=...;"[/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] oOracleConn [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] OracleConnection = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] OracleConnection[/SIZE]
[SIZE=2][COLOR=#008000]'(GATEWAY=rsgis-summer2.erd.ds.usace.army.mil)[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] some_str [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] some_num [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] Array[/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] sys_time [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] DateTime[/SIZE]
[SIZE=2]some_str = TextBox1.Text[/SIZE]
[SIZE=2]TextBox3.Text = sys_time[/SIZE]
[SIZE=2][COLOR=#0000ff]Try[/COLOR][/SIZE]
[SIZE=2]oOracleConn.ConnectionString = oradb[/SIZE]
[SIZE=2]MsgBox("1.Connecting...")[/SIZE]
[SIZE=2]i = 0[/SIZE]
[SIZE=2]Timer1.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]True[/COLOR][/SIZE]
[SIZE=2]oOracleConn.Open()[/SIZE]
[SIZE=2]Timer1.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]False[/COLOR][/SIZE]
[SIZE=2]Label2.Text = i[/SIZE]
[SIZE=2]MsgBox("1.Connected!")[/SIZE]
[SIZE=2]MsgBox("connect for data...")[/SIZE]
[SIZE=2]i = 0[/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] cmd [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] OracleCommand("ruby", oOracleConn)[/SIZE]
[SIZE=2]Timer1.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]True[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'cmd.Connection = oOracleConn[/COLOR][/SIZE]
[SIZE=2]Timer1.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]False[/COLOR][/SIZE]
[SIZE=2]Label2.Text = i[/SIZE]
[SIZE=2]MsgBox("connection!")[/SIZE]
[SIZE=2]MsgBox("2.Getting command...")[/SIZE]
[SIZE=2]i = 0[/SIZE]
[SIZE=2]Timer1.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]True[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'cmd.CommandText = "Select num from test" & "INSERT INTO test VALUES(@num, @str);"[/COLOR][/SIZE]
[SIZE=2]cmd.CommandType = CommandType.StoredProcedure[/SIZE]
[SIZE=2][COLOR=#008000]'cmd.CommandText = "EXECUTE :=ruby(@num,@str);"[/COLOR][/SIZE]
[SIZE=2]cmd.Parameters.Add([/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] OracleParameter("@num", OracleDbType.Double, ParameterDirection.Input))[/SIZE]
[SIZE=2]cmd.Parameters("@num").Value = 32[/SIZE]
[SIZE=2]cmd.Parameters.Add([/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] OracleParameter("@str", OracleDbType.NChar, 20))[/SIZE]
[SIZE=2]cmd.Parameters("@str").Value = "justin"[/SIZE]
[SIZE=2]cmd.ExecuteNonQuery()[/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] Ds [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] DataSet[/SIZE]
[SIZE=2]Timer1.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]False[/COLOR][/SIZE]
[SIZE=2]Label2.Text = i[/SIZE]
[SIZE=2]MsgBox("2.Got Command!")[/SIZE]
[SIZE=2][COLOR=#008000]'MsgBox("collect command...")[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'MsgBox("Collected!")[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] dr [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] OracleDataAdapter(cmd)[/SIZE]
[SIZE=2]MsgBox("3.Reciving command...")[/SIZE]
[SIZE=2]i = 0[/SIZE]
[SIZE=2]Timer1.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]True[/COLOR][/SIZE]
[SIZE=2]MsgBox("Executing procedure...")[/SIZE]
[SIZE=2]dr.Fill(Ds)[/SIZE]
[SIZE=2]MsgBox("Procedure executed")[/SIZE]
[SIZE=2][COLOR=#008000]'dr.Read()[/COLOR][/SIZE]
[SIZE=2]Timer1.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]False[/COLOR][/SIZE]
[SIZE=2]Label2.Text = i[/SIZE]
[SIZE=2]MsgBox("3.Recived Command!")[/SIZE]
[SIZE=2][COLOR=#008000]'MsgBox("outputing data...")[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'Label1.Text = dr.Item(0) ' or dr.Item(0)[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]' MsgBox("done!")[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Catch[/COLOR][/SIZE][SIZE=2] ex [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] OracleException [/SIZE][SIZE=2][COLOR=#008000]' catches only Oracle errors[/COLOR][/SIZE]
[SIZE=2]Timer1.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]False[/COLOR][/SIZE]
[SIZE=2]Label2.Text = "Error!"[/SIZE]
[SIZE=2][COLOR=#0000ff]Select[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Case[/COLOR][/SIZE][SIZE=2] ex.ToString[/SIZE]
[SIZE=2][COLOR=#0000ff]Case[/COLOR][/SIZE][SIZE=2] 1[/SIZE]
[SIZE=2]MsgBox("Error attempting to insert duplicate data.")[/SIZE]
[SIZE=2][COLOR=#0000ff]Case[/COLOR][/SIZE][SIZE=2] 12545[/SIZE]
[SIZE=2]MsgBox("The database is unavailable.")[/SIZE]
[SIZE=2][COLOR=#0000ff]Case[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Else[/COLOR][/SIZE]
[SIZE=2]MsgBox("Database error: " + ex.Message.ToString())[/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Select[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Catch[/COLOR][/SIZE][SIZE=2] de [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] DataException[/SIZE]
[SIZE=2]MsgBox(de.Message.ToString())[/SIZE]
[SIZE=2][COLOR=#0000ff]Finally[/COLOR][/SIZE]
[SIZE=2]MsgBox("4.Disconnecting...")[/SIZE]
[SIZE=2]i = 0[/SIZE]
[SIZE=2]Timer1.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]True[/COLOR][/SIZE]
[SIZE=2]oOracleConn.Dispose()[/SIZE]
[SIZE=2]Timer1.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]False[/COLOR][/SIZE]
[SIZE=2]Label2.Text = i[/SIZE]
[SIZE=2]MsgBox("4.Disconnected!")[/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Try[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Timer1_Tick([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Object, [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2] Timer1.Tick[/SIZE]
[SIZE=2]i = i + 1[/SIZE]
[SIZE=2]Label2.Text = i[/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Button2_Click([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Object, [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2] Button2.Click[/SIZE]
[SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].Close()[/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Class[/COLOR][/SIZE]