J
JJ297
I have a field called Office Code on my page. It's not mandatory that
it be filled in but if it's not filled in I want 0000 to go into the
database. How do I write this? I attempted it below.
Dim cmd As New Data.SqlClient.SqlCommand
With cmd
.Connection = conn
.CommandType = Data.CommandType.StoredProcedure
.CommandText = "AddLoanRequest"
.Parameters.AddWithValue("@TitleID",
Integer.Parse(Request.QueryString("TitleID")))
.Parameters.AddWithValue("@RequestDate", LoanDate.Text)
.Parameters.AddWithValue("@description",
Request.QueryString("classificationid"))
.Parameters.AddWithValue("@FName", FName.Text)
.Parameters.AddWithValue("@LName", LName.Text)
.Parameters.AddWithValue("@PhoneNum", PhNoTxt.Text)
If OfcCodeTxt.Text = "" Then
OfcCodeTxt.Text = "0000"
Else
.Parameters.AddWithValue("@OfficeCode",
OfcCodeTxt.Text)
End If
End With
it be filled in but if it's not filled in I want 0000 to go into the
database. How do I write this? I attempted it below.
Dim cmd As New Data.SqlClient.SqlCommand
With cmd
.Connection = conn
.CommandType = Data.CommandType.StoredProcedure
.CommandText = "AddLoanRequest"
.Parameters.AddWithValue("@TitleID",
Integer.Parse(Request.QueryString("TitleID")))
.Parameters.AddWithValue("@RequestDate", LoanDate.Text)
.Parameters.AddWithValue("@description",
Request.QueryString("classificationid"))
.Parameters.AddWithValue("@FName", FName.Text)
.Parameters.AddWithValue("@LName", LName.Text)
.Parameters.AddWithValue("@PhoneNum", PhNoTxt.Text)
If OfcCodeTxt.Text = "" Then
OfcCodeTxt.Text = "0000"
Else
.Parameters.AddWithValue("@OfficeCode",
OfcCodeTxt.Text)
End If
End With