Home > Net >  Help: abnormal from HRESULT: 0 x800a03ec
Help: abnormal from HRESULT: 0 x800a03ec

Time:09-23

Export EXCEL tip: "abnormal from HRESULT: 0 x800a03ec," the OFFICE version of 2010, after the replacement of 2007 tips,
Error screenshots and code see attachment, for the great god,

using System;
using System.Collections.Generic;
using System.Linq;
Using System. The Web;
Using System. Web. UI.
using System.Web.UI.WebControls;
using System.Data;
Using System. The Data. SqlClient.
Using System. The Configuration;
Using Excel.=the Microsoft Office. Interop. Excel;
Using System.Data.Com mon;
using System.IO;


Public partial class JGNCXX: System. Web. UI. Page
{
Protected void Page_Load (object sender, EventArgs e)
{
if (! IsPostBack)
{
String name=(string) Session (" name_pub "),/* own the session name parameter */
If (name==null)
{
Response. Redirect (" Default. Aspx ");
}
}
}
Protected void Page_LoadComplete (object sender, EventArgs e)
{
String name=(string) Session (" name_pub "),/* own the session name parameter */
Label Mlable1=(Label) this. The Master. FindControl (" Label2 ");/* access label controls on the master page */
Mlable1. Text="welcome:" + name;
String yhjb1=(string) Session (" jb_pub "),/* receive passed user level parameter */
//Button Mbut1=(Button). This Master. The FindControl (" Button3 ");/* * button controls on access to the master page/
//Button Mbut2=(Button). This Master. The FindControl (" Button4 ");/* * button controls on access to the master page/
/* if (Convert ToInt32 (yhjb1)==1)
{
Mbut1. Visible=true;//if the button is the administrator is displayed the user management and data import button
Mbut2. Visible=true;
}
The else
{
Mbut1. Visible=false;
Mbut2. Visible=false;
}
*/
}
//connected to the LAN system database storage
Public SqlConnection GetConnection ()
{
String stglStr=ConfigurationManager. AppSettings [r]. "connectionString" ToString ();
SqlConnection myConn=new SqlConnection (stglStr);
Return myConn;
}


//a custom data binding function Grid1ViewBind
Protected void Grid1ViewBind ()
{
SqlConnection stglconn=GetConnection ();
Stglconn. The Open ();
//string lcrid=(string) Session (" dlmc_pub ");//deposits person ID
String JGHM=(string) Session (" jghm_pub "),////get deposits institution number
String date_str=TextBox1. Text;
String year1=date_str. Substring (0, 4);
String month1=date_str. Substring (5, 2);
String day1.=date_str Substring (8, 2);
String sqlstr_sel="select * from deposits balance shows that fine where=@ year1 year and month=@ month1 and days=@ day1 and agency number=@ JGHM";
SqlCommand mycmd_sel=new SqlCommand (sqlstr_sel stglconn);
Mycmd_sel. The Parameters. The Add (" @ year1 ", System. Data. SqlDbType. NVarChar, 4). The Value=https://bbs.csdn.net/topics/year1;
Mycmd_sel. The Parameters. The Add (" @ month1, System. Data. SqlDbType. NVarChar, 2). The Value=https://bbs.csdn.net/topics/month1;
Mycmd_sel. The Parameters. The Add (" @ day1, System. Data. SqlDbType. NVarChar, 2). The Value=https://bbs.csdn.net/topics/day1.Trim ();
Mycmd_sel. The Parameters. The Add (" @ JGHM ", System. Data. SqlDbType. NVarChar, 10). The Value=https://bbs.csdn.net/topics/jghm.Trim ();

SqlDataAdapter myda_sel=new SqlDataAdapter (mycmd_sel);
The DataSet myds_sel=new DataSet ();
Myda_sel. The Fill (myds_sel);
//to find the filled table myds_sel of balance and in the
String jehj=myds_sel. Tables [0]. Compute (" sum (point balance) ", "true"). The ToString ();
Label5. Text=jehj;
GridView1. The DataSource=myds_sel. Tables [0];
GridView1. DataBind ();
Stglconn. The Dispose ();
Myda_sel. The Dispose ();
Myds_sel. The Dispose ();
}

Protected void Grid2ViewBind ()
{
SqlConnection stglconn=GetConnection ();
Stglconn. The Open ();
//string lcrid=(string) Session (" dlmc_pub ");//deposits person ID
String JGHM=(string) Session (" jghm_pub "),////get deposits institution number
String date_str=TextBox2. Text;
String year1=date_str. Substring (0, 4);
String month1=date_str. Substring (5, 2);
String day1.=date_str Substring (8, 2);
String sqlstr_sel="select * from deposits balance summary table where the year=@ year1 and month=@ month1 and days=@ day1 and agency number=@ JGHM";
SqlCommand mycmd_sel=new SqlCommand (sqlstr_sel stglconn);
Mycmd_sel. The Parameters. The Add (" @ year1 ", System. Data. SqlDbType. NVarChar, 4). The Value=https://bbs.csdn.net/topics/year1;
Mycmd_sel. The Parameters. The Add (" @ month1, System. Data. SqlDbType. NVarChar, 2). The Value=https://bbs.csdn.net/topics/month1;
Mycmd_sel. The Parameters. The Add (" @ day1, System. Data. SqlDbType. NVarChar, 2). The Value=https://bbs.csdn.net/topics/day1.Trim ();
Mycmd_sel. The Parameters. The Add (" @ JGHM ", System. Data. SqlDbType. NVarChar, 10). The Value=https://bbs.csdn.net/topics/jghm.Trim ();

SqlDataAdapter myda_sel=new SqlDataAdapter (mycmd_sel);
The DataSet myds_sel=new DataSet ();
Myda_sel. The Fill (myds_sel);
GridView2. The DataSource=myds_sel. Tables [0];
GridView2. DataBind ();
Stglconn. The Dispose ();
Myda_sel. The Dispose ();
Myds_sel. The Dispose ();
}
Protected void Button6_Click (object sender, EventArgs e)
{

If (TextBox1. Text=="")
{
Enclosing RegisterStartupScript (" ", "& lt; Script language=javascript> Alert (' please select query time! ') & lt;/script>" );
return;
}
//binding function called
Grid1ViewBind ();

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  •  Tags:  
  • C #
  • Related