Home > Net >  After the release of the System. IndexOutOfRangeException: unable to find a table of 0
After the release of the System. IndexOutOfRangeException: unable to find a table of 0

Time:09-16

Unable to find a table 0,

Note: during the execution of the current Web request, abnormal untreated, please check the stack trace, to learn about the errors and mistakes in the code of the source of detailed information,

Exception details: System. IndexOutOfRangeException: unable to find a table 0,

The error source:


Line 138: string filePath=Server. MapPath (" ~ \ \ excel \ \ "). The ToString ();
Line 139: set=ExcelToDS (file, filePath);
Line 140: the for (int a=0; A. & lt; Set the Tables [0]. Columns. The Count; +)
Line 141: {
Line 142: set Tables [0]. Columns [a]. ColumnName=set. The Tables [0]. Rows [0] [a]. ToString ();

CodePudding user response:

Should be set. The Tables [0] error,
You may excel no data, leading to set no tables,
Or your ExcelToDS appeared abnormal?

CodePudding user response:

There was no table set

CodePudding user response:

Thank you for your reply, I think it should be is a question of authority, because the same code, there is nothing wrong with the same upload files to the local operation,

CodePudding user response:

reference baidu_28764923 reply: 3/f
thank you for your reply, I think it should be is a question of authority, because the same code, there is nothing wrong with the same upload files to the local operation,


I also in the presence of the same type of error, can search the database, when local operating table, connecting to the server database connection is successful, but dstTemp. Tables [0]. Rows. Count & gt; 0 anomaly shows a database table does not exist, solved now?

CodePudding user response:

Connect to the server only changed the local IP address, there should be no other effects, the server only to send and receive data, the permission is to point to what

CodePudding user response:

Add an if (the set!=null & amp; & Set the table. Count> 0)
  •  Tags:  
  • C #
  • Related