Try
If addFiscalYear.SelectedValue <> 0 Then
SqlDataSource1.InsertParameters("FiscalYear").DefaultValue = addFiscalYear.SelectedValue
End If
If addProjectName.Text <> "" Then
SqlDataSource1.InsertParameters("ProjectName").DefaultValue = addProjectName.Text
End If
If addProjectName.Text <> "" Then
SqlDataSource1.InsertParameters("ResearchersName").DefaultValue = addResearchersName.Text
End If
If addFiscalYear.SelectedValue <> 0 Then
SqlDataSource1.InsertParameters("Faculty").DefaultValue = addFaculty.SelectedValue
End If
If addBudget.Text = Then
SqlDataSource1.InsertParameters("Budget").DefaultValue = addBudget.Text
End If
If addFiscalYear.SelectedValue <> 0 Then
SqlDataSource1.InsertParameters("SourceFunds").DefaultValue = addSourceFunds.SelectedValue
End If
SqlDataSource1.Insert()
addFiscalYear.SelectedIndex = 0
addProjectName.Text = ""
addResearchersName.Text = ""
addFaculty.SelectedIndex = 0
addBudget.Text = ""
addSourceFunds.SelectedIndex = 0
lblFis.Text = ""
lblFac.Text = ""
lblSource.Text = ""
Catch ex As Exception
lblFis.Text = "*เลือกปี"
lblFac.Text = "*เลือกคณะ"
lblSource.Text = "*เลือกแหล่งทุน"
ตรง If addBudget.Text = Then อะครับควรเช็คอย่างไรดี
Tag : .NET, Web (ASP.NET), VB.NET, VS 2010 (.NET 4.x)