R
Ryan Anderson
I am looking for an example that displays the proper way to handle NULL date
vaules
when working with updating the data grid;
When updating a record I am returning the field values;
Dim dCloseDate As Date = CType(e.Item.FindControl("cm_R_CLSEDATE"),
TextBox).Text
Dim iRate As String = CType(e.Item.FindControl("cm_R_RATE"), TextBox).Text
Dim iLoanAmount As Integer = CType(e.Item.FindControl("cm_R_LOANAMT"),
TextBox).Text
' Setting up the SP parameters
paramsToStore(3) = New SqlParameter("@cm_R_CLSEDATE", SqlDbType.Datetime)
paramsToStore(4) = New SqlParameter("@cm_R_RATE", SqlDbType.Float)
paramsToStore(5) = New SqlParameter("@curLoanAmount", SqlDbType.Float)
' Retrieving the parameters from the cache
storedParams(3).Value = dCloseDate
storedParams(4).Value = iRate
storedParams(5).Value = iLoanAmount
' Using the MS Data Application Block
Dim ds As DataSet
ds = SqlHelper.ExecuteDataset(sDBConnString, CommandType.StoredProcedure,
sql, storedParams)
I either blow up here with the date if it's NULL
String was not recognized as a valid DateTime.
'fill the DataSet using default values for DataTable names, etc.
Line 462: da.Fill(ds)
When the date field in left blank, which is in the application Block code Or
here;
Input string was not in a correct format.
System.FormatException: Input string was not in a correct format.
Line 243: Dim iLoanAmount As Integer =
CType(e.Item.FindControl("cm_R_LOANAMT"), TextBox).Text
I am not that savy in .NET and I am unsure how to properly handle these NULL
values when I update the DB.
Please let me know if you have a better way of doing it, or have an link to
a high speed example!
Much thanks for your time!
Ryan
Marina Mortgage
La Jolla, CA USA
vaules
when working with updating the data grid;
When updating a record I am returning the field values;
Dim dCloseDate As Date = CType(e.Item.FindControl("cm_R_CLSEDATE"),
TextBox).Text
Dim iRate As String = CType(e.Item.FindControl("cm_R_RATE"), TextBox).Text
Dim iLoanAmount As Integer = CType(e.Item.FindControl("cm_R_LOANAMT"),
TextBox).Text
' Setting up the SP parameters
paramsToStore(3) = New SqlParameter("@cm_R_CLSEDATE", SqlDbType.Datetime)
paramsToStore(4) = New SqlParameter("@cm_R_RATE", SqlDbType.Float)
paramsToStore(5) = New SqlParameter("@curLoanAmount", SqlDbType.Float)
' Retrieving the parameters from the cache
storedParams(3).Value = dCloseDate
storedParams(4).Value = iRate
storedParams(5).Value = iLoanAmount
' Using the MS Data Application Block
Dim ds As DataSet
ds = SqlHelper.ExecuteDataset(sDBConnString, CommandType.StoredProcedure,
sql, storedParams)
I either blow up here with the date if it's NULL
String was not recognized as a valid DateTime.
'fill the DataSet using default values for DataTable names, etc.
Line 462: da.Fill(ds)
When the date field in left blank, which is in the application Block code Or
here;
Input string was not in a correct format.
System.FormatException: Input string was not in a correct format.
Line 243: Dim iLoanAmount As Integer =
CType(e.Item.FindControl("cm_R_LOANAMT"), TextBox).Text
I am not that savy in .NET and I am unsure how to properly handle these NULL
values when I update the DB.
Please let me know if you have a better way of doing it, or have an link to
a high speed example!
Much thanks for your time!
Ryan
Marina Mortgage
La Jolla, CA USA