Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report