Get the App
SLTechnology News&Howtos  ›  Database  › 

How to realize that the grid component judgment field can not be empty in the database

Shulou Source: shulou.com Published: 2022-05-31 13:52:51 10月24日 Update

This article is about how to realize that the grid component judgment field can not be empty in the database. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

In recent development, it is found that the last grid part judgment field cannot be empty code, but there are still some shortcomings:

If you delete a piece of data in the grid with the following code before saving:

If showquestion ("are you sure you want to remove focus?") Then purchase plan score details. DeleteFocusedRow () end if

Then an error will be reported when executing the code in the previous post.

Examples of improvements:

'submit units and data to rows

Detailed scoring of purchase plans. PostEditor ()

'submit row data to DataTable

Purchase plan scoring details. GridView.UpdateCurrentRow ()

'add scoring ID in batch

Detailed scoring of the purchase plan. SetColumnValue ("scoring ID", recording component 1.GetFieldValue ("ID"), 1)

'BeginTrans ()

The database is operated here.

Recording unit 1.SaveData ()

Detailed scoring of the purchase plan. SaveData ()

'judge the execution result of the transaction

If CommitTrans () = false then

Showerror (GetTransMessage ())

End if

Dim A = 0

Detailed scoring of dim dt= purchase plan. DataTable

Before saving, ask "have these annual purchase plans been discussed at the meeting?"

If ShowQuestion ("have these annual procurement plans been discussed at the meeting?") Then

For each dr in dt.Rows

If isnull (dr ["Total score"]) or isnull (dr ["approval status"]) then

A = 1

Exit for

End if

Next

Else

For each dr in dt.Rows

If isnull (dr ["Total score"]) then

A = 2

Exit for

End if

Next

End if

If A = 1 then

ShowInformation ("Please fill in [approval] and [total score] completely")

Dim b = purchase plan scoring details. AddColumnStyleBy _ Expression ("approval status", "[approval status] is null", True)

B.Appearance.ForeColor=Color.FromArgb (- 65536)

Dim c = detailed grading of the procurement plan. AddColumnStyleby _ Expression ("is null", "[total score", True)

C.Appearance.ForeColor=Color.FromArgb (- 65536)

Else if A = 2 then

ShowInformation ("Please complete the [total score]")

Dim d = detailed grading of the procurement plan. AddColumnStyleby _ Expression ("is null", "[total score", True)

D.Appearance.ForeColor=Color.FromArgb (- 65536)

Else

Me.Output1 = "Y"

ShowInformation ("saved successfully")

Me.Close ()

End if

Thank you for reading! This is the end of the article on "how to realize that the judgment field of grid components can not be empty in the database". I hope the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, you can share it out for more people to see!

Tags: Procurement total score data parts grid situation field database code content year more article previous good practical successful transaction unit article Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Redmi Linux Shulou Tech Info Docker