Create click event that use two different store procedures (insert/update)

DARK__FOXX

Member
Joined
Sep 2, 2020
Messages
9
Programming Experience
Beginner
I created a method inside the aspx file that automatically inserts the fieldsin a form with two ASP.NET Textbox and one ASP.NET label. the user should only add the deadline and when he clicks on the Save button, he should check if the deadline does not exist add it otherwise leave the field unchanged.

VB.NET:
 Public Sub INSERT_EXP_DATE_TABLE()



        Try
            cmd.Connection = cn
            cmd.CommandType = CommandType.StoredProcedure
            MyParm = cmd.Parameters.Add("@CD_CUSTOTMER", SqlDbType.Int)
            MyParm.Value = CInt(txt_CD_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 = txt_EXP_DATE.Text
            cmd.CommandText = "LST_INSERT_TABLE_01"
            cmd.Connection.Open()
            cmd.ExecuteNonQuery()
            MsgBox("Record registered!", vbInformation)
        Catch ex As Exception
            MsgBox(ex.Message)

        Finally
            cn.Close()
        End Try

    End Sub
This is my store procedure:
VB.NET:
@CD_CUSTOMER int,
@COMPANY_NAME nvarchar(50),
@EXP_DATE date,
@DTINIT DATETIME
AS

IF EXISTS(SELECT 'True' FROM TABLE WHERE CODE_CUSTOMER = @CODE_CUSTOMER)
BEGIN
SELECT 'FIELD EXIST'
END
ELSE
BEGIN
SELECT 'Record ADD'
INSERT INTO TABLE
                (
                CD_CUSTOMER,
                COMPANY_NAME,
                EXP_DATE,
                DTINIT
                )

                VALUES
                (
             
                @CD_CUSTOMER,
                @COMPANY_NAME,
                @EXP_DATE,
                @DTINIT
                )
END
After loading it how do I put it in the column of a table that is inside the repeater?
Forgive for the explanation, but I have searched on various guides and tried different solutions, but also from parsing errors in date field.
 
Top Bottom