Well, my pick for the NCAA finals was wrong - Syracuse beat Kansas - but I still won my office pool. Next year, maybe my team (MSU Spartans) will get a bit farther, but I think everyone was pretty happy with them getting to the Elite 8 - a better showing than I expected.
Here is a bit of code to format a standard US date into the format used by Oracle. Of course, the strDate would normally be a variable:
Dim strDate As Date = "1/5/03"
Dim strOracleDate As String = strDate.ToString("dd-MMM-yy").ToUpper()
Well, I got some good feedback about my last post - thank you everyone! It would be more efficient to add the parameters before the loop, instead of in the loop. I had implemented the code before I thought about optimization. This blog is working out, even if it is me that is learning some new things!
My two picks for the NCAA Finals came true. Let's see if Kansas wins tonight.
Okay, this bit of code iterates through a loop, running a stored procedure for each pass. The only item that differs from the normal use of a stored procedure is the line that reads objComm.Parameters.Clear(). Without this line, the parameters would continue to be added and not reset as they should be.
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
‘Db declarations and such
For i = intFirst To intLast
objParam = objComm.Parameters.Add("ID", OleDbType.Numeric, 7)
objParam.Direction = ParameterDirection.Input
objParam.Value = Session("ID")
objParam = objComm.Parameters.Add("strOne", OleDbType.Numeric, 7)
objParam.Direction = ParameterDirection.Input
objParam.Value = strOne
objParam = objComm.Parameters.Add("strTwo", OleDbType.Numeric, 7)
objParam.Direction = ParameterDirection.Input
objParam.Value = strTwo
objComm.ExecuteScalar()
objComm.Parameters.Clear()
End If
Next
End Sub
I would like to welcome you to my brand spanking new .NET blog. My plan for this site is to post little pieces of code I have developed or found and modified to fit my needs. Some of it may seem simplistic at times, but I have found that often, I have forgotten about a very simple way to solve a problem. Any way, here is my first bit of code...
Validate date in a textbox:
To verify that a TextBox control contains a date, use the CompareValidator control. The key pieces to this are the Operater and Type properties of the control.
<asp:CompareValidator ID="valDateFiled" ControlToValidate="txtDateFiled" Runat="server" ErrorMessage="Invalid Date Filed" Operator="DataTypeCheck" Type="Date">*</asp:CompareValidator>
More Posts