新网创想网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
已经几乎是asp点虐 代码了。
目前创新互联建站已为上1000+的企业提供了网站建设、域名、网站空间、网站托管运营、企业网站设计、北湖网站维护等服务,公司将坚持客户导向、应用为本的策略,正道将秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。
winuser.??在asp点虐 应用里面无效。
似乎你想发邮件,在asp点虐 里面发送邮件,请使用system点虐 .mail命名空间下的功能。
给你一个我自己写的代码,以供参考:
Imports Microsoft.VisualBasic
Imports System.Net.Mail
Imports System.Net.Mime
Public Class LiteMail
''' summary
''' 发送一个文本邮件到指定的电子邮箱。
''' /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点抗 ") '发件人邮箱
m1.To.Add(New MailAddress(MailTo))
Dim c As SmtpClient = New SmtpClient("mail.domain点抗 ") 'smtp服务器地址
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 是服务器名或服务器的IP地址
//DATABASE 是数据库名
//Table 是表名
try {
// 开始导出
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: "数据透视表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("数量");
xPivotField.Orientation = 4;
// 关闭工具条
//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);
}
可以,点击项目菜单 下面的项目属性,在应用程序选项卡中有 目标框架 选择 选 4.0就可以了
没有这个选项 则安装点虐 framework 4.0 之后就会有了
"项目"-"[项目]属性"
获得项目属性对话框
"编译"页签-"高级编译选项"
获得高级编译选项对话框
"目标Framework(所有配置)"
这就是你要的了