iT邦幫忙

0

EasyFlow表單設計(Grid元件取值)

c#
  • 分享至 

  • xImage

我是新手,想請教各位高手,請問要如何從Grid元件內,抓取資料呢?
如果還要配合db的預存程式,是否能提供程式,參考呢?
感謝。

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

0
allenlwh
iT邦高手 1 級 ‧ 2016-03-27 17:27:35

這是一段寫在CheckFieldData裡面的Sample code

<pre class="c" name="code">		
	'********************************************************************* 
	'程序名稱: CheckFieldData() 
	'          表單傳送前欄位檢查函數 
	' 
	'程序說明: 您可以在這裡寫下表單傳送前欄位檢查的程式碼。 
	'          成功時 sysCheckFieldData 欄位傳回 True,失敗傳回 False 
	'********************************************************************* 

 Dim aryData, nItem

		If Grid_Detail.Rows <> 0 Then
			For nItem = 0 To Grid_Detail.Rows - 1
				aryData = Grid_Detail.GetRowByVBArray(nItem)
				If Trim(aryData(0)) = "" Then
					strErr = strErr & "[產品敘述]不可空白。" & vbCrLf
					blnError = True
					Exit For
				End If
				
				'If Trim(aryData(1)) = "" Then
				'	strErr = strErr & "[品名]不可空白。" & vbCrLf
				'	blnError = True
				'	Exit For
				'End If
				'If Trim(aryData(2)) = "" Then
				'	strErr = strErr & "[供應商]不可空白。" & vbCrLf
				'	blnError = True
				'	Exit For
				'End If
				If Trim(aryData(4)) = "" Then
					strErr = strErr & "[採購數量]不可空白。" & vbCrLf
					blnError = True
					Exit For
				End If
				If Not IsNumeric(aryData(4)) Then
					strErr = strErr & "[採購數量]必須為數值。" & vbCrLf
					blnError = True
					Exit For
				End If
				If CLng(aryData(4)) < 0 Then
					strErr = strErr & "[採購數量]不可小於零。" & vbCrLf
					blnError = True
					Exit For
				End If
				'If Trim(aryData(5)) = "" Then
				'	strErr = strErr & "[單位]不可空白。" & vbCrLf
				'	blnError = True
				'	Exit For
				'End If
				If Trim(aryData(6)) = "" Then
					strErr = strErr & "[採購單價]不可空白。" & vbCrLf
					blnError = True
					Exit For
				End If
				If Not IsNumeric(aryData(6)) Then
					strErr = strErr & "[採購單價]必須為數值。" & vbCrLf
					blnError = True
					Exit For
				End If
				If CDbl(aryData(6)) <= 0 Then
					strErr = strErr & "[採購單價]不可等於零。" & vbCrLf
					blnError = True
					Exit For
				End If
				If Trim(aryData(7)) = "" Then
					strErr = strErr & "[採購金額]不可空白。" & vbCrLf
					blnError = True
					Exit For
				End If
				If Not IsNumeric(aryData(7)) Then
					strErr = strErr & "[採購金額]必須為數值。" & vbCrLf
					blnError = True
					Exit For
				End If
				If CLng(aryData(7)) <= 0 Then
					strErr = strErr & "[採購金額]不可等於零。" & vbCrLf
					blnError = True
					Exit For
				End If
				'If Trim(aryData(8)) = "" Then
				'	strErr = strErr & "[預交日期]不可空白。" & vbCrLf
				'	blnError = True
				'	Exit For
				'End If
				'If Not IsDate(aryData(8)) Then
				'	strErr = strErr & "[預交日期]必須為日期。" & vbCrLf
				'	blnError = True
				'	Exit For
				'End If
				If Trim(aryData(9)) = "" Then
					strErr = strErr & "[採購碼]不可空白。" & vbCrLf
					blnError = True
					Exit For
				End If
				If Trim(aryData(10)) = "" Then
					strErr = strErr & "[結案碼]不可空白。" & vbCrLf
					blnError = True
					Exit For
				End If
			Next
		Else
			strErr = strErr & "明細表至少要有一筆資料。" & vbCrLf
			blnError = True
		End If
satan5304 iT邦新手 5 級 ‧ 2016-03-30 16:41:47 檢舉

@@不好意思,我意思指Grid裡已有資料了,我是需要取出Grid裡面的資料,取到的資料,想要透過預存程式,寫到另一個DB內。

我要發表回答

立即登入回答