Hi,
can anyone know what mean of "Exception has been thrown by the target of an invocation"?
1st, drag the Company table and store procedure into dbml file
then in my LinqDataSource1_Inserting method is normal code
and inside LinqDataSource1_Inserted method:
Dim cp As New LinqAdvanceRegisterDataContext
Dim tempCompany As New Company
tempCompany.CompanyID = cp.P_GetLastRecordOfCompany().Last.CompanyID
tempCompany.Supervisor1 = cp.P_GetLastRecordOfCompany().Last.Supervisor1
tempCompany.S1Email = cp.P_GetLastRecordOfCompany().Last.S1Email
tempCompany.S1Phone = cp.P_GetLastRecordOfCompany().Last.S1Phone
tempCompany.Supervisor2 = cp.P_GetLastRecordOfCompany().Last.Supervisor2
tempCompany.S2Email = cp.P_GetLastRecordOfCompany().Last.S2Email
tempCompany.S2Phone = cp.P_GetLastRecordOfCompany().Last.S2Phone
Dim aa As New LinqAdvanceRegisterDataContext
If tempCompany.Supervisor1.Trim.Length > 0 Then
aa.P_AddSupervisor(tempCompany.CompanyID, tempCompany.Supervisor1, tempCompany.S1Phone, CType(formView1.FindControl("txtS1Fax"), TextBox).Text, tempCompany.S1Email)
End If
If tempCompany.Supervisor2.Trim.Length > 0 Then
aa.P_AddSupervisor(tempCompany.CompanyID, tempCompany.Supervisor2, tempCompany.S2Phone, CType(formView1.FindControl("txtS2Fax"), TextBox).Text, tempCompany.S2Email)
End If
Response.Redirect(NavigateURL(PortalSettings.HomeTabId))
and because cannot cast from cp.P_GetLastRecordOfCompany() into company type, so i do that way
the data is success insert into database, but it appear the error, even i restart the page~
help~~~