我有以下代码:
Dim i As Integer
For i = 1 To 20
Dim captionTextBox As TextBox = DirectCast(Me.FindControl("news_Image" + i.ToString() + "CaptionTextBox"), TextBox)
Dim deleteCheckBox As CheckBox = DirectCast(Me.FindControl("Image" + i.ToString() + "DeleteCheckBox"), CheckBox)
If Not deleteCheckBox.Checked = False Then
If Not captionTextBox.Text = "" Then
'Insert the value of the textbox into the column like news_Image1Caption, news_image2Caption nased on the value of i
End If
End If
Next
如果评论在上面的代码中,我需要将文本框(文本)的值插入Linq列。例如:articleToUpdate.news_Image1Caption,news_Image2Caption,但我需要将news_之后的数字更改为for循环中的i值。我怎么能这样做?
由于
路
答案 0 :(得分:0)
您是否尝试将ID列设置为自动生成值= true?
INSERT INTO [dbo].[s_Tbl]([ID], [news_Image1Caption], [news_image2Caption]) VALUES (...)