Any help would be appreciated... Code works cleanly until error...
Error occuring at line: SqlDataSource3.UpdateParameters("TechID").DefaultValue() = CInt(technicianRow("TechID"))
Here is full VB code:
Imports System.Data
Partial Class IncidentAssignment
    Inherits System.Web.UI.Page
    Public incidentRow As DataRowView
    Public technicianRow As DataRowView
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        'Check to see if a incident has been selected
        If GridView1.SelectedIndex = -1 Then
            Button1.CommandName = ""
            lblmessage.Text = "You must select an incident."
        Else
            Button1.CommandName = "NextView"
            lblmessage.Text = ""
        End If
    End Sub
    Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
        'Check to see if a incident has been selected
        If GridView2.SelectedIndex = -1 Then
            Button3.CommandName = ""
            lblmessage2.Text = "You must select a technician."
        Else
            Button3.CommandName = "NextView"
            lblmessage2.Text = ""
            'Create second DataView
            Dim techniciansTable As DataView = CType(SqlDataSource2.Select(DataSourceSelectArguments.Empty), DataView)
            'Save the selected technician data row
            'To the DataRowView object and to session state
            technicianRow = techniciansTable(GridView2.SelectedIndex)
            Session("Technician") = technicianRow
            'Create DataView
            Dim incidentsTable As DataView = CType(SqlDataSource1.Select(DataSourceSelectArguments.Empty), DataView)
            'Save PageIndex and PageSize to variables.
            Dim pageIndex As Integer = GridView1.PageIndex
            Dim pageSize As Integer = GridView1.PageSize
            'Calculate the value of the SelectedIndex
            Dim selectedIndex As Integer = (pageIndex * pageSize) + GridView1.SelectedIndex
            'Save the selected data row to the DataRowView
            'object and to session state
            incidentRow = incidentsTable(selectedIndex)
            Session("Incident") = incidentRow
            'Display output from the two DataRowView objects
            Label1.Text = incidentRow("Name")
            Label2.Text = incidentRow("ProductCode")
            Label3.Text = technicianRow("Name")
        End If
    End Sub
    Public Sub btnAssign_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAssign.Click
        'Assign data from session state to
        'the two DataRowView objects
***ERROR technicianRow = CType(Session("Technician"), DataRowView)
        incidentRow = CType(Session("Incident"), DataRowView)
        'Update the value of the two parameters to be
        'used to store new information about the
        'assigned technician
        SqlDataSource3.UpdateParameters("TechID").DefaultValue() = CInt(technicianRow("TechID"))
        SqlDataSource3.UpdateParameters("IncidentID").DefaultValue() = CInt(incidentRow("IncidentID"))
        'Trap errors
        T开发者_Python百科ry
            'Update the table.
            SqlDataSource3.Update()
            'Unselect the two GridView controls
            GridView1.SelectedIndex = -1
            GridView2.SelectedIndex = -1
            'Rebind the GridView controls
            GridView1.DataBind()
            GridView2.DataBind()
            'Move to the first view
            MultiView1.ActiveViewIndex = 0
        Catch ex As Exception
            Session("Exception") = ex
            Session("Page") = "~/Admin/IndicentAssignment.aspx"
            Response.Redirect("~/ErrorMessage.aspx")
        End Try
    End Sub
    Protected Sub GridView2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView2.SelectedIndexChanged
    End Sub
End Class
Remove the parenthesis from ".DefaultValue()
do you have the parameters defined on the sqldatasource in the page??
UpdateParameters>
              <asp:Parameter Name="SomeName" Type="String" />
              <asp:Parameter Name="SomeDescription" Type="String" />
            </UpdateParameters>
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论