已經(jīng)幾乎是asp點虐 代碼了。
目前創(chuàng)新互聯(lián)建站已為上1000+的企業(yè)提供了網(wǎng)站建設(shè)、域名、網(wǎng)站空間、網(wǎng)站托管運營、企業(yè)網(wǎng)站設(shè)計、北湖網(wǎng)站維護等服務(wù),公司將堅持客戶導(dǎo)向、應(yīng)用為本的策略,正道將秉承"和諧、參與、激情"的文化,與客戶和合作伙伴齊心協(xié)力一起成長,共同發(fā)展。
winuser.??在asp點虐 應(yīng)用里面無效。
似乎你想發(fā)郵件,在asp點虐 里面發(fā)送郵件,請使用system點虐 .mail命名空間下的功能。
給你一個我自己寫的代碼,以供參考:
Imports Microsoft.VisualBasic
Imports System.Net.Mail
Imports System.Net.Mime
Public Class LiteMail
''' summary
''' 發(fā)送一個文本郵件到指定的電子郵箱。
''' /summary
''' param name="MailTo"收件人電子郵件地址/param
''' param name="Subject"郵件標題/param
''' param name="Body"郵件正文/param
''' remarks/remarks
Public Shared Sub SendMail(ByVal MailTo As String, ByVal Subject As String, ByVal Body As String)
Dim m1 As MailMessage = New MailMessage
m1.BodyEncoding = System.Text.Encoding.UTF8
m1.IsBodyHtml = True
m1.From = New MailAddress("youmail@domain點抗 ") '發(fā)件人郵箱
m1.To.Add(New MailAddress(MailTo))
Dim c As SmtpClient = New SmtpClient("mail.domain點抗 ") 'smtp服務(wù)器地址
m1.Subject = Subject
m1.Body = Body
c.UseDefaultCredentials = False
c.Credentials = New System.Net.NetworkCredential("youname@domain點抗 ", "password") ’郵箱地址,密碼
c.DeliveryMethod = SmtpDeliveryMethod.Network
Try
c.Send(m1)
Finally
End Try
End Sub
End Class
Excel.Application excel = default(Excel.Application);
Excel._Workbook xBk = default(Excel._Workbook);
Excel._Worksheet xSt = default(Excel._Worksheet);
Excel.Range xRange = default(Excel.Range);
Excel.PivotCache xPivotCache = default(Excel.PivotCache);
Excel.PivotTable xPivotTable = default(Excel.PivotTable);
Excel.PivotField xPivotField = default(Excel.PivotField);
string cnnsr = null;
string sql = null;
string[] RowFields = {
"",
"",
""
};
string[] PageFields = {
"",
"",
"",
"",
"",
""
};
//SERVER 是服務(wù)器名或服務(wù)器的IP地址
//DATABASE 是數(shù)據(jù)庫名
//Table 是表名
try {
// 開始導(dǎo)出
cnnsr = "ODBC;DRIVER=SQL Server;SERVER=" + SERVER;
cnnsr = cnnsr + ";UID=;APP=Report Tools;WSID=ReportClient;DATABASE=" + DATABASE;
cnnsr = cnnsr + ";Trusted_Connection=Yes";
excel = new Excel.ApplicationClass();
xBk = excel.Workbooks.Add(true);
xSt = xBk.ActiveSheet;
xRange = xSt.Range("A4");
xRange.Select();
// 開始
xPivotCache = xBk.PivotCaches.Add(SourceType: 2);
xPivotCache.Connection = cnnsr;
xPivotCache.CommandType = 2;
sql = "select * from " + Table;
xPivotCache.CommandText = sql;
xPivotTable = xPivotCache.CreatePivotTable(TableDestination: "Sheet1!R3C1", TableName: "數(shù)據(jù)透視表1", DefaultVersion: 1);
//準備行字段
RowFields[0] = "字段1";
RowFields[1] = "字段2";
RowFields[2] = "字段3";
//準備頁面字段
PageFields[0] = "字段4";
PageFields[1] = "字段5";
PageFields[2] = "字段6";
PageFields[3] = "字段7";
PageFields[4] = "字段8";
PageFields[5] = "字段9";
xPivotTable.AddFields(RowFields: RowFields, PageFields: PageFields);
xPivotField = xPivotTable.PivotFields("數(shù)量");
xPivotField.Orientation = 4;
// 關(guān)閉工具條
//xBk.ShowPivotTableFieldList = False
//excel.CommandBars("PivotTable").visible = False
excel.Visible = true;
} catch (Exception ex) {
if (cnn.State == ConnectionState.Open) {
cnn.Close();
}
xBk.Close(0);
excel.Quit();
MessageBox.Show(ex.Message, "報表工具", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
可以,點擊項目菜單 下面的項目屬性,在應(yīng)用程序選項卡中有 目標框架 選擇 選 4.0就可以了
沒有這個選項 則安裝點虐 framework 4.0 之后就會有了
"項目"-"[項目]屬性"
獲得項目屬性對話框
"編譯"頁簽-"高級編譯選項"
獲得高級編譯選項對話框
"目標Framework(所有配置)"
這就是你要的了