I have to create a small management for an expiration date.
I created a form with 2 textboxes and a label.
The user only has to fill in the deadline manually inside a Textbox.
I have created a class for reading where the data is displayed in a repeater.
Inside the repeater there is a column where the click is automatically inserted the data inside the form except the expiration, because this column comes from a table that I created new and empty inside the db.
Now I have created two classes that do insert and update.
My problem is that the method does not recognize the values passed into the form, but from default values.
This is the insert method:
and this is Click event:
Also I was wondering if there was another way to create this Save button using stored procedures.
I created a form with 2 textboxes and a label.
The user only has to fill in the deadline manually inside a Textbox.
I have created a class for reading where the data is displayed in a repeater.
Inside the repeater there is a column where the click is automatically inserted the data inside the form except the expiration, because this column comes from a table that I created new and empty inside the db.
Now I have created two classes that do insert and update.
My problem is that the method does not recognize the values passed into the form, but from default values.
This is the insert method:
HTML Code:
Public Sub INSERT_EXP_DATE_TABLE()
MyParm = cmd.Parameters.Add("@ID_CUSTOMER", SqlDbType.Int)
MyParm.Value = CInt(txt_COD_CUSTOMER.Text)
MyParm = cmd.Parameters.Add("@COMPANY_NAME", SqlDbType.NVarChar)
MyParm.Value = lbl_COMPANY_NAME.Text
MyParm = cmd.Parameters.Add("@EXP_DATE", SqlDbType.Date)
MyParm.Value = CDate(txt_EXP_DATE.Text)
Try cmd.Connection = cn
cmd.CommandText = "LST_INSERT_TABLE_01"
cmd.CommandType = CommandType.StoredProcedure cmd.Connection.Open()
cmd.ExecuteNonQuery()
MsgBox("Date expired conferm", vbInformation)
Catch ex As Exception
MsgBox(ex.Message)
Finally
cn.Close()
End Try
End Sub
HTML Code:
Protected Sub btn_Save_Click(sender As Object, e As EventArgs)
For Each item As RepeaterItem In Repeater1.Items
Dim txt_exp_date As TextBox = item.FindControl("TXT_exp-date")
If txt_exp_date IsNot "" Then
Dim insert As New Class_LST_INSERT_TABLE
insert.INSERT_EXP_DATE_TABLE()
Exit For
Else
Dim update As New Class_LST_UPDATE_TABLE
update.UPDATE_EXP_DATE_TABLE()
Exit For
End If
Next
End Sub