ช่วยหน่อยครับ พอเอา code ขึ้น server แล้ววัน error แบบนี้ครับ เกิดจากอะไรครับ
Server Error in '/Telephone_Test' Application.
--------------------------------------------------------------------------------
Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.]
System.Windows.Forms.MessageBox.ShowCore(IWin32Window owner, String text, String caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, Boolean showHelp) +3194718
Microsoft.VisualBasic.Interaction.MsgBox(Object Prompt, MsgBoxStyle Buttons, Object Title) +564
Telephone.WebForm1.ReadExcel() in C:\Users\athumwm\Documents\Visual Studio 2012\Projects\Telephone\Telephone\Telephone.aspx.vb:134
Telephone.WebForm1.Button1_Click(Object sender, EventArgs e) in C:\Users\athumwm\Documents\Visual Studio 2012\Projects\Telephone\Telephone\Telephone.aspx.vb:44
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
Protected Sub ReadExcel()
Try
Dim MyCE As New OleDbConnection
Dim DtTable As New DataTable
Dim StrShetname, Filename, strcon, SiteCall, STQ As String
Dim Dtset As DataSet
Dim DdateE, DdateD As DateTime
Dim Dadapter As SqlDataAdapter
Dim Ddset As New DataSet
Dim Dr As DataRow
Dim i As Integer
MyCE = New System.Data.OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0; " & _
"data source='" & FUP.PostedFile.FileName & " '; " & "Extended Properties=""Excel 8.0;HDR=NO;IMEX=1;""")
Dim oApp As New Excel.Application
Dim oBooks As Excel.Workbooks = oApp.Workbooks
Dim oBook As Excel.Workbook = oBooks.Add(FUP.PostedFile.FileName)
Dim oSheet As Excel.Worksheet = oApp.ActiveSheet
StrShetname = oSheet.Name
DdateE = oSheet.Cells.Item(2, "B").Value
If LCase(FUP.FileName) = "metal.xlsx" Or LCase(FUP.FileName) = "metal.xls" Then
Filename = "METAL"
ElseIf LCase(FUP.FileName) = "foam.xlsx" Or LCase(FUP.FileName) = "foam.xls" Then
Filename = "FOAM"
ElseIf LCase(FUP.FileName) = "jit.xlsx" Or LCase(FUP.FileName) = "jit.xls" Then
Filename = "JIT' Or site = 'Trim' Or site = 'SG&A"
ElseIf LCase(FUP.FileName) = "taap.xlsx" Or LCase(FUP.FileName) = "taap.xls" Then
Filename = "TAAP"
End If
strcon = "select distinct update_date from telephone where site = '" & Filename & "'"
Dadapter = New SqlDataAdapter(strcon, myconnection)
Ddset = New DataSet()
Dadapter.Fill(Ddset)
If Ddset.Tables(0).Rows.Count <> 0 Then
DdateD = Ddset.Tables(0).Rows(0)("update_date")
Else
DdateD = "#1/1/2000 12:00AM#"
End If
If DdateD < DdateE Then
SiteCall = oSheet.Cells.Item(3, "B").Value
DtTable.Columns.Add("Name")
DtTable.Columns.Add("Dept")
DtTable.Columns.Add("Site")
DtTable.Columns.Add("TelNo")
DtTable.Columns.Add("Extension")
DtTable.Columns.Add("PhoneNumber")
DtTable.Columns.Add("update_date")
i = 5
Do While Not Trim(oSheet.Cells.Item(i, "B").Value) = ""
Dr = DtTable.NewRow
Dr("Name") = oSheet.Cells.Item(i, "B").Value
Dr("Dept") = oSheet.Cells.Item(i, "C").Value
Dr("Site") = oSheet.Cells.Item(i, "D").Value
Dr("TelNo") = SiteCall
Dr("Extension") = oSheet.Cells.Item(i, "E").Value
Dr("PhoneNumber") = oSheet.Cells.Item(i, "F").Value
Dr("update_date") = DdateE
DtTable.Rows.Add(Dr)
i = i + 1
Loop
DGV.Visible = True
DGV.DataSource = DtTable
DGV.DataBind()
Dtset = Nothing
STQ = "Delete from Telephone Where site ='" & Filename & "'"
SQLAcc(STQ)
SQLadd(DtTable)
Else
LBconnect.ForeColor = Drawing.Color.Red
LBconnect.Font.Bold = True
LBconnect.Text = "This file date is Expire!!!"
End If
Catch ex As Exception
LBconnect.ForeColor = Drawing.Color.Red
LBconnect.Font.Bold = True
LBconnect.Text = ex.Message
End Try
End Sub